Is there a way to convert bubble chart size? - vb.net

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?

Related

how to increase or get desired distance along the X axis in BoxPlot?

How do I manually set the distances along the X-axis so I can read all the column names properly?
Code
trainData[trainData.columns].plot(kind='box',widths=0.1, grid = True)

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

X Axis is moving down when changing y axis value in core plot

I'm using coreplot for my project,the problem i'm struggling for past few hours is,i need to update the y axis values every time user enter changes value.To constraint the y axis range i'm using [graph.defaultPlotSpace scaleToFitPlots:[graph allPlots]]but with this i'm facing issue with x axis position,it's changing every time i change the value for y axis.
As you can see,the x axis is moving from down to up.How can i fix this problem?
-scaleToFitPlots: adjusts the plot space to fit the plot data exactly. You can use it as a starting point to fit the data and then expand the resulting range to leave extra space around the edges or to fix the location of one of the ranges. For example, you could adjust the calculated yRange so the location is always at zero (0).

plotting matrices with gnuplot

I am trying to plot a matrix in Gnuplot as I would using imshow in Matplotlib. That means I just want to plot the actual matrix values, not the interpolation between values. I have been able to do this by trying
splot "file.dat" u 1:2:3 ps 5 pt 5 palette
This way we are telling the program to use columns 1,2 and 3 in the file, use squares of size 5 and space the points with very narrow gaps. However the points in my dataset are not evenly spaced and hence I get discontinuities.
Anyone a method of plotting matrix values in gnuplot regardless of not evenly spaced in Xa and y axes?
Gnuplot doesn't need to have evenly space X and Y axes. ( see another one of my answers: https://stackoverflow.com/a/10690041/748858 ). I frequently deal with grids that look like x[i] = f_x(i) and y[j] = f_y(j). This is quite trivial to plot, the datafile just looks like:
#datafile.dat
x1 y1 z11
x1 y2 z12
...
x1 yN z1N
#<--- blank line (leave these comments out of your datafile ;)
x2 y1 z21
x2 y2 z22
...
x2 yN z2N
#<--- blank line
...
...
#<--- blank line
xN y1 zN1
...
xN yN zNN
(note the blank lines)
A datafile like that can be plotted as:
set view map
splot "datafile.dat" u 1:2:3 w pm3d
the option set pm3d corners2color can be used to fine tune which corner you want to color the rectangle created.
Also note that you could make essentially the same plot doing this:
set view map
plot "datafile.dat" u 1:2:3 w image
Although I don't use this one myself, so it might fail with a non-equally spaced rectangular grid (you'll need to try it).
Response to your comment
Yes, pm3d does generate (M-1)x(N-1) quadrilaterals as you've alluded to in your comment -- It takes the 4 corners and (by default) averages their value to assign a color. You seem to dislike this -- although (in most cases) I doubt you'd be able to tell a difference in the plot for reasonably large M and N (larger than 20). So, before we go on, you may want to ask yourself if it is really necessary to plot EVERY POINT.
That being said, with a little work, gnuplot can still do what you want. The solution is to specify that a particular corner is to be used to assign the color to the entire quadrilateral.
#specify that the first corner should be used for coloring the quadrilateral
set pm3d corners2color c1 #could also be c2,c3, or c4.
Then simply append the last row and last column of your matrix to plot it twice (making up an extra gridpoint to accommodate the larger dataset. You're not quite there yet, you still need to shift your grid values by half a cell so that your quadrilaterals are centered on the point in question -- which way you shift the cells depends on your choice of corner (c1,c2,c3,c4) -- You'll need to play around with it to figure out which one you want.
Note that the problem here isn't gnuplot. It's that there isn't enough information in the datafile to construct an MxN surface given MxN triples. At each point, you need to know it's position (x,y) it's value (z) and also the size of the quadrilateral to be draw there -- which is more information than you've packed into the file. Of course, you can guess the size in the interior points (just meet halfway), but there's no guessing on the exterior points. but why not just use the size of the next interior point?. That's a good question, and it would (typically) work well for rectangular grids, but that is only a special case (although a common one) -- which would (likely) fail miserably for many other grids. The point is that gnuplot decided that averaging the corners is typically "close enough", but then gives you the option to change it.
See the explanation for the input data here. You may have to change your data file's format accordingly.

Make the X and Y axis scales equal on an Excel chart

I'd like the X and Y axes of my Excel charts to have the same scale on the screen, because I'm plotting geographical data. A 1km by 1km square should look like a square, not like a rectangle, i.e. no squishing of the map in one or the other direction. In Matlab, the command that would do this is axis equal.
How do I do this using VBA?
Am I overlooking an even simpler solution directly in Excel?
In addition to guitarthrower's answer you will need to do the following:
Select the 'Plot Area' of the chart and then manually set the height and width of the plot area.
Sheets("Chart1").PlotArea.Select
Selection.Height = 500
Selection.Width = 500
Just setting the axis min and max values will still allow the chart to be 'squished'.
When you select the plot area and write Selection.Width = something, the Width value you are setting also includes the width of the axis labels/text. This may not be what you want.
Instead, you can set the INSIDE Width/Height value using
Selection.InsideHeight = 250
Selection.InsideWidth = 250
Another method similar to Stewbob's is to set the limits to some ratio of each other (my plots are 4 times as wide as they are tall) and then use the height to set the width.
ActiveChart.PlotArea.Select
Selection.Width = Selection.Height * 4