Hide y axis below a certain x value when floating zero - excel

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.

Related

How to hold the value of a variable in excel bar graph?

I have a plot in excel bar graph as shown in the image. But I want the Y axis data to be held at it's value until the next discrete sample in X axis .i.e the value of Y axis is 160.8 at X=1, and I want this value to be held until X=2 where the value of Y changes to 2. How do I do this?
Edit 1 - I tried following this tutorial and it worked - https://trumpexcel.com/step-chart-in-excel/
But I had to format the X axis cells to date format. I want the same to work when X axis format is a number.

Permanently changing the range of the axes using matplotlib?

I have been using pandas, matplotlib and seaborn for data visualisation but I can't figure out how to permanently change the axes limits? I will show you what I mean below:
I want the y axis to go from 0 to 300 and the x axis from -4 to 4 (so that the background grid is complete, none of the squares are cut off).
In general I want the following:
Let the step on the y_axis be z (so 50 in the case above). Then, matplotlib automatically stops the y axis at y_max (maximum y value from the data).
This y_max lands in between kz and (k+1)z, for some positive integer k (in the case above, it lands between 250 and 300, so 5*50 and 6*50, so k=5). Now, I want the y axis to stop at (k+1)z and not y_max.
And similarly for the x-axis.
I know that I can set the y limits and x limits manually for each plot, but is there a way I can somehow permanently get matplotlib/pandas/seaborn to automatically create the figures in such a way?
I tried looking at the rcParams on matplotlib but couldn't really see anything of use.

Select data within the area of a series in 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.

Data points are not moving on the X Axis Scatter Plot in Excel

I have an excel scatter plot which is working for the Y axis but not the X Axis. If I change the Y values the data point moves accordingly. However, the X axis seems to be fixed in positions. The closest thing I can identify to logic is that the first number in the series is the X axis as 1, the next is 2, 3, 4, and so on
I would like (5.6,3) to show up at (5.6,3) not (1,3) because it's the first in the series.
Example for X axis theory:
Series
X ------ Y ------ graph placement
.6 ----- 3 ------ (1,3)
1.2 ---- 3.4 ---- (2,3.4)
.8 ----- 5.2 ---- (3,5.2)
notice the X coordinates 1,2,3 are moving sequential with their placement in the series.
Example for Y axis working:
(1.333,1) is placed at (3,1) on the plot. If I change it to (1.333,2) then it goes to (3,2). The X Axis changes do not move the point.
I give up. On the right is a chart that I think represents what you are seeing, driven by the data as shown which includes a single inverted comma I prefixed 1.333 with. On the left I overlaid an image of the chart I see without that inverted comma - and I think represents what you want:

Axis value with different decimals in excel

How can I have y axis values with 2 different decimals without using VBA?
I have values in y axis (0.01, 0.10, 1.00, 10.00, 100.00).
I want to change as follows ( to have 2 different decimals): 0.01, 0.10, 1.0, 10.0, 100.0.
If the Y axis on your chart shows values that are in the vicinity of 100, then values in the vicinity of 0.01 will be pretty hard to spot.
Even values less than 10 will not show as a significant blip. What difference does the Y axis label make for units that are not showing, anyway?
If you want to make such fine a distinction, you will want to use two different charts from the outset.
Right click on your y-axis, then click Format Axis. Under Axis Options, check Logarithmic scale.

Resources