How to display 2D bar graph with number of counts on Y-axis and month/day on x-axis in LabVIEW? - labview

I want to plot 2D bar graph in LabVIEW showing total number of counts on Y-axis and Month/day(abbreviated) on x-axis. How can I do it?

Drop an XY graph.
Go to the plot properties and set Bar Plots to have the style you want and Interpolation to be just points.
If you open the context help window and hover over the terminal for the graph, you can see the data types it supports. You want the cluster which has a 1D array for the X values (timestamps of a time in the specific day) and a 1D array for the Y values. Generate your data in that format and wire it into the graph.
Right click the X scale and select Formatting.... In the properties dialog, set the format to be absolute time and to only show the day and the month.
Run the VI and you should have your graph.

Related

Using matplotlib to plot a matrix with the third variable as source for a color map

Say you have the matrix given by three arrays, being:
x = N-dimensional array.
y = M-dimensional array.
And z is a set of "somewhat random" values from -0.3 to 0.3 in a NxM shape. I need to create a plot in which the x values are in the x-axis, y values are in the y-axis and using z as the source to indicate the intensity of each pixel with a color map.
So far, I have tried using
plt.contourf(x,y,z)
and the resulting plot is very nice for me (attached at the end of this paragraph), but a smoothing is automatically applied to the plot! I need to be able to distinguish the pixels and I cannot find a way to do it.
contourf result
I have also studied the possibility of using
ax.matshow(z)
in order to sucesfully see the pixels... but then I am struggling trying to personalize the x and y axis, since only the index of the pixel is shown (see below).
matshow result
Would you please give me some ideas? Thank you.
Without more information on your x,y data it's hard to know, but I would guess you are looking for pcolormesh.
plt.pcolormesh(x,y,z)
This would take the x and y data as input and hence shows the z data at the appropriate coordinates.
You can use imshow with the keyword interpolation='nearest'.
plt.imshow(z, interpolation='nearest')

Is there a way to convert bubble chart size?

I have created a bubble chart using the fusion charts api in asp.net. The question/issue I have is leaning more on scaling the chart itself, rather than the particular library I used to generate it.
The chart I have is designed like this:
X = roi
y = lift
circle size = revenue
The code below sets the max/min values of the x axis:
roiMax += 30 'pad the max and min roi values so the bubble wont cut off
roiMin -= 30
I used the new roi min/max values and set them as the minimum/maximum x axis values. It seems to work in most cases. However, if the points displayed are all near each other, then the bubbles become squished together.
If I comment out the portion where I set the x/y max min value of the chart, it looks to scale more properly. However, there are bubbles that cut off if it reaches the edge of the chart. So I want to try to set min/max values for x and y so I can show the full bubble. However, to do that I need to use the circle size to grab the length so I can determine the proper chart limits. Is there a way to convert the size into units of x or the units of y for me to find the proper limit?

dual y axis plotting causes data points looks messy at left corner of chart

i am using MPAndroid charting toolkit for data visualization. chart plotting smooth in MPAndroid but problem arise when i try plot dual y axis(left& right). As right axis appear data points on spread over the x axis completely. all data points appearing on the left of chart. How can i spread the data points ?
mChart = (LineChart) findViewById(R.id.Chart);
mChart.setGridBackgroundColor(Color.parseColor("#F4F4F4"));
mChart.setDrawGridBackground(false);
mChart.setTouchEnabled(true);
mChart.setHighlightEnabled(false);
mChart.setDragEnabled(false);
mChart.setScaleEnabled(true);
mChart.setPinchZoom(true);
mChart.setDescription("");
mChart.getAxisLeft().setAxisMaxValue(YMaxValue);
mChart.getAxisLeft().setAxisMinValue(YMinValue);
mChart.getAxisLeft().setStartAtZero(false);
mChart.getAxisRight().setEnabled(false);
if(General.InnerClass.Y2AxisValues.size()>0)
{
mChart.getAxisRight().setEnabled(true);
mChart.getAxisRight().setSpaceBottom(12.25f);
mChart.getAxisRight().setAxisMaxValue(Y2MaxValue);
mChart.getAxisRight().setAxisMinValue(Y2MinValue);
mChart.getAxisRight().setStartAtZero(false);
mChart.getXAxis().setAvoidFirstLastClipping(true);
}
mChart.setData(data);
progbar.setVisibility(View.GONE);
mChart.invalidate();
Before
After
The data points are exactly where they should be. The only thing that has changed is the range of values that is displayed on each axis.
--> this range is now significationly lower because only one set of data is represented by each axis, before, one axis had to scale large enough to display both datasets.
I suggest you read the documentation of the YAxis and simply increase the range of values that should be displayed on the axis.
while plotting y2 axis providing the x values is the problem. values for the x axis should be provide for single time. providing twice add the values to x axis exiting values get doubled.
thnx #philipp

Programmatically set drawCircle on a per value basis on LineChart

Is there a way to toggle drawCircle on individual data points? From the documentation it appears you can only enable this at the dataset level. I'm trying to draw circles for the min/max of a dataset.
If there isn't a way to draw circles on individual data points another workaround I've tried implementing has been to create a second dataset and only plot the corresponding X index and min/max Y value; every other value is set small enough that it is not visible in the viewport. The only problem here is I can't seem to plot both datasets without overwriting the first dataset's background fill.

core plot stacked graph crossing top border

I'm trying to create a stacked graph using core plot.i have followed this tutorial.I have a UISlider on sliding i'm updating my graph.The issue i'm facing is my top value for y-axis is touching top border(As in the screen shot). As per my requirement in need to round off the highest value to next 10th value so that my graph doesn't touch the borders.On changing my slider value the x and y axis should also get refresh,i'm doing it by regenerating plot but it takes a lot of memory.Any idea how can i achieve these requirement ?
Don't recreate the whole graph every time the values change. Call -reloadData on the graph to refresh the plot data and set the xRange and yRange of the plot space to change the scale of the axes.