Select data within the area of a series in Excel - excel

Ok, so I have two data series graphed, like so.
These are two scatter plots, based on x and y values, that are produced using a combo chart. The orange scatter plot is an ellipse whose calculation is based upon aspects relating to the purple scatter plot. I have made the orange ellipse in order to... well... select the part of the purple scatter plot that I want to do other things with. Problem is, I don't know how to actually select the data points this area refers to.
The data for this chart is based upon four columns: A,B (forming the purple plot) and C,D (forming the orange plot). Reordering the columns makes little difference.
Implementing Anger's proposed solution below, all instances seem to return true. Also, there happen to be more scatter plot rows than there are ellipse rows, so I'm not sure how to solve that for the sake of comparison.

If you specify the equation of the ellipse (center point and semi-major/minor axes), you can use the equation of the ellipse to flag points that are inside or outside.
if( ((Ex-x)/Lx)^2+((Ey-y)/Ly)^2 < 1, "INSIDE", "OUTSIDE")
Where Ex, Ey are the coordinates of the ellipse's center; x, y are your data point's coordinates, and Lx, Ly are the semi-major and semi-minor axes.
Just by eye, I would say Ex = 1.8, Ey = 1.21, Lx = 0.6, and Ly = 0.5.

Related

Hide y axis below a certain x value when floating zero

Say I have data graphed in an xy scatter with straight lines and markers. Data are plotted at (1, 3), (2, 4), (3, 0), and (4, 0). The last two data points are directly on the x axis. To fix this, I want the x axis to be slightly below y= 0.
Here's what I've tried:
Setting the min-y value to a negative number (e.g. -1). I then set the x axis to cross at a number greater than y = -1 (e.g. y= -.02). While this drops the x axis (i.e. floats the zero) as desired, the y axis and negative y-axis values up to -1 are shown on the graph. Typically to cover this area up, I add a white shape with no border. This is neither elegant nor works well when set up in VBA to be used with data sets of various sizes.
When I set the min value to y=-.02 and the x axis to cross at y= -.02, I don't have to worry about the negative values on the y-axis, but the major interval changes to .8, 1.8, 2.8, etc. If I wanted to change the major interval to 0.5, 1.0, 1.5, etc., I'd need to set the min value to -.5, which is far too large when I only want the data points to be slightly above y=0.
Any thoughts?
The regular axis formatting options won't do what you want to achieve, so you need a workaround. For example:
Hide the X axis altogether by formatting it to have no line. Use a new data series with two points. The first point is X=0, Y=-0.02, the second data point is x=the max of the other two series (formula) and Y is the same as the first data point.
Format this series as a line without markers and use it in lieu of the X axis. You can even make the position of this fake X axis dynamic by calculating the Y value from your data, if you want.
This will work with data from the grid, so you don't need to manipulate with VBA, but you could place the series with VBA instead, if you want.
If you need more help implementing this, leave a comment and I'll add more detail.

Converting plot X, Y to location to draw arrow/line

I have a bunch of data that I'm plotting as point plots. The data is simply a column for X and a column for Y. The catch here though is this is plotted using axes x2y2.
The x1y1 is used for a histogram. The X axis is the same range for both plots.
I know how to derive the X coordinate, but am wondering if there is an easy way to determine the Y value to use to draw an arrow. I want to draw an arrow callout for an arbitrary point on the point plot.
y1 and y2 are independent.
The coordinates for drawing the arrow can refer to different coordinate systems (first, second, character, screen, and graph, see help coordinates).
So, to draw an arrow e.g. from the top-middle of the plot (graph 0.5, graph 1) to x2 = 1, y2 = 2 (second 1, second 2) you would write
set arrow from graph 0.5, graph 1 to second 1, second 2 head

Converte circle coordinates in to degree values in gnuplot

I have a data file with 3 columns: The first 2 are coordinates of a circle, the 3. are results . How can I convert this x-y-coordinates into a range of degree (range of the x-axis: 0 - 360). I want to show results in a XY-plot. I don't want to create a further column in my data file, I want to convert the values directly with gnuplot. Is this possible?
Just remember your high school geometry and how to convert Cartesian coordinates to polar coordinates. Suppose you have a Cartesian coordinate (x, y). Draw a line between this point and the origin. The angle θ between this line and the x-axis is related by tan θ = y/x and the distance r from the origin is sqrt(x2 + y2).
So your angle θ is just the arc tangent (inverse tangent) of y/x. In gnuplot, this is the atan() function. I'd write something like this:
set angles degrees
plot 'infile.dat' using (atan($2/$1)):3 with points
where column 3 is your "result" (the roughness) and columns 1 and 2 are your Cartesian coordinates. It uses the calculated θ value for the horizontal plotted axis and the roughness for the vertical plotted axis.
The set angles command lets you set the unit used by atan() to degrees or radians. Since you specified a range of 0-360, it is set angles degrees.
It will plot the points in the order as they appear in the file. Notice that depending on the order of points in your data file, the order of the points after this calculation may no longer be visually sequential, so this example uses with points.

multiple legends in excel chart

Is there a way in Excel to have 2 legends for a single chart?
I have an excel chart with many series. Let's take the following structure.
X AY1 AY2 BY1 BY2 CY1 CY2
1 2 3 4 5 6 7
3 11 2 5 23 45 65
X column represents the horizontal scale the rest of the columns represent the vertical scales. A, B and C are something like a category, and Y1 and Y2 are series for each category. Now, Y1 and Y2 have the same line style, no matter what category, but the category gives the color.
So in this example Y1 is dashed and Y2 is dotted. A is blue, B is red and C is green. This leads to:
AY1 - blue dashed, AY2 - blue dotted,
BY1 - red dashed, BY2 - red dotted,
CY1 - green dashed,CY2 - green dotted.
Currently my legend is AY1, AY2 and so on, with the dash style and color.
Because I can have more than 10 categories with more than 2 series for each of them, I will end up with a legend of no. of categories * no. of series, which is not necessary.
Instead I would like a legend like: Y1 - dashed, Y2 - dotted(each series line type only once) and then a legend with the color for each category( A- red, B - blue, C - green).
Is this possible in Excel?
Thanks!
Excel only does one legend per chart. Each series will have an entry in the legend. You can manually select a legend entry and delete it.
You could manually construct a text box or similar, and place that on the chart to achieve the effect you describe.
So, if I understand correctly, I'd add two dummy series to the chart with 0 values and assign them dashed and dotted respectively, with a neutral gray color. Then delete every series but the gray ones from the legend.
Then create a drawing with the colors for the real data series and place it on top of the chart as a secondary legend.
Edit: thinking about this a bit more, here is another approach. Use dummy series purely for the purpose of showing in the legend. Consider this screenshot:
Your original data table has been charted and the series have been formatted as to your instructions above.
Then another set of data was added to the chart as new series.
Y1 and Y2 have been formatted with gray and dashed / dotted respectively
A, B and C have been added with their respective colors.
The next step is to click, select and delete the legend entries for AY1, AY2 etc., and keep only the legend entries for the helper series. Finally, edit the source data for the helper series and set all data to 0 or 1, so nothing gets plotted in the chart. The result looks like this:
You could even change the chart type for the colored helper series to a dot, so the legend will show a dot instead of a line:

Second y axis displaced

I am quite new to gnuplot. And I've got problem with secondary y axis. When I try to plot two curves into one graph with two different y axis, the second one is moved down a little bit. I mean that if you draw a straight line parallel to the x axis at y1 = 0, you get different y2 values. I want both y axes to start at the same point y1=0 ~ y2=0.
Here is the picture better describing my problem:

Resources