How to create and show real-time heatmaps with PyQtGraph? - pyqt

I want to create and show a real-time heatmap on my PyQt window.
The horizontal axis of the heatmap is time, and the vertical axis ranges from 0 to 180. The program adds a column of data at regular intervals.
it looks like this: My Heatmap , and it is real-time, with a method:
def update():
img.add_column(data)
I try to create a heatmap using matplotlib. But I found that every time I add a column of data, the whole picture has to be redrawn, so this method is very slow.
I learned that using PyQtGraph it is possible to quickly draw a real-time heatmap and I would like to know how I can do it and embed it into my pyQt window.

Related

How can I customize the horizontal axis values in excel?

So I am trying to make a nice line graph for some data that I have. Each line has 100 data points, so excel automatically makes the horizontal axis from 1-100. I want to change the min/max values for the horizontal axis from 0-1, without moving the frame of the graph (i.e. without zooming in the graph). I just want to divide the horizontal axis numbers by 100 in order to rescale the time. This is what my graph looks like now:
http://imgur.com/33KD7RY
So I want to change the numbers on the horizontal axis to be fractions or decimals in the range [0,1]. Does anyone know how I can do this, or any other graphing software that would allow me to do this (I have tried using google sheets, but they have less options to customize axes than excel). Thank you!
Did you use two column to plot one line and did you use the Scatter with smooth lines chart type?
Have one column (X) go from 0 to 1 using intervals of 0.01 and your data in your second column (Y). When using a scatter with smooth lines chart type your answer should look like this:
image graph
Plotting your second line in the same chart can be done the same way by adding it through the 'select data' options of the chart.

How to plot Bubble chart with plots outside axis area using Excel

Im using Excel for Mac 2011 and I have the following figure
I would like to still show the bubbles outside of the available chart area, while keeping the maximum and minimum axes values unchanged.
Create an identical chart with the same data, but with axis limits that show the full bubbles. Then set all the formatting in the chart other than the bubbles to the equivalent of "none", i.e, no axis labels, chart outlines, gridlines, chart and plot borders, background color, etc.
With very careful sizing and positioning of this bubbles-only chart over the original chart, you can get the bubbles to extend beyond the plot area of the original. If the size or position of a bubble is a little off, modify the overlay chart's data by the tiny amount needed to get the bubble to cover the underlying original bubble. Turn off the formatting for the underlying bubbles as last step.
NOT programmatic, very trial and error, and fussy, of course, and I hope someone comes up with a more elegant way to achieve your goal. But I was able to get it to work on my Windows machine.

fill the area with color in time series jfreechart

I am trying to generate a time series with the area underneath filled with color.
Looking at examples of the jfreechart library there is this method:
ChartFactory.createAreaChart(...)
However the dataset required is a Category dataset, something quite different from the Time Series Dataset that I currently create:
ChartFactory.createTimeSeriesChart(...)
Which methods should I use to fill with color the area underneath the plotted line?
Thank you!
Add the following after you create the a chart (using createTimeSeriesChart)
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRenderer(new XYAreaRenderer());

I want to make a scatter graph of the output of ftrace (from kernel)

I want to make a scatter graph of the output of ftrace (from kernel) on asm_do_IRQ..The problem is there are 8000+ entries and I get the results as a single line plot. Is there any way to do a normalisation of the values so that I can get a scatter plot? The values I want to print are as below:
Interrupt Time
uart-pl011 196.98111
Nomadi 196.983246
prcmu 196.983307
dma40 196.983429
dma40 196.984222
Nomadi 196.98642
dma40 196.988922
prcmu 196.988953
since the number of values are huge, excel takes time on the Y axis and plots the number of interrupts on the X axis. But i want the interrupts by name on the Y axis and time on the X axis.
looks like this is not possible. Scatter graphs can only be used to plot two variables, and since one of the axes i want to plot is a string, this is not possible - i can only get a trend, not the exact plots vs time

MATLAB: why would an axis have its position property changed?

I'm working on a custom plot on top of which I add a second blank axis object to show a secondary scale on the right hand side of the graph (as well as the primary scale on the left hand side).
Works great (and had been, for years), until I tried it again recently in R2010a and for some reason the primary axis gets its Position property tweaked when the figure is resized or printed, so that it looks OK on the screen at first, but when I print it or resize the figure, the two axes don't line up vertically.
What would do this, and how can I set it up so the two axes maintain the same position?
aha: I think I found it:
http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f1-32495.html
Controlling Axes Size
When you create a graph, MATLAB automatically creates an axes to display the graph. The axes is sized to fit in the figure and automatically resizes as you resize the figure. However, MATLAB applies the automatic resize behavior only when the axes Units property is set to normalized (the default).
Note: MATLAB changes only the current axes' properties by default. If your plot has multiple axes, MATLAB will not automatically resize any secondary axes.
You can control the resize behavior of the axes using the following axes properties:
...
ActivePositionProperty — Specifies whether to use the OuterPosition or the Position property as the size to preserve when resizing the figure containing the axes.
You may find the linkprop function helpful

Resources