I faced an issue while using axis crossing with Excel. In this i have moved the x and y axis line with the labels as like in the below screenshot.
Here the axis line has collided with the axis labels as highlighted in yellow colored. So, kindly suggest me a way to over come this in Excel.
Thanks in advance,
Dharani.
Related
I wanted to display my data from my Excel spreadsheet graphically, in the form of a scatter chart.
I know that Excel can do this, but there is one "special feature" about my coordinate system of my graphic, and that is that one of the axes should be labeled with "words" (instead of numbers) to match my table similar to the picture. But I am not sure if Excel can process this at all, I guess that Excel can only work with numbers on the axes.
I would be very grateful for any help and tips and also alternatives!
By definition, the axes in an XY Scatter plot are numeric. But your desired chart can easily be created by adding a helper series to the plot. Assuming the current Y values for the other series are the numbers 1 to 6 for even positioning, you can use a range with Y values 1 to 6 and X values of zero and add that data range as a new series to the plot.
The plot points will sit right on the Y axis. Remove the Y axis labels in the Axis formatting options. You can then use data labels from the worksheet and position them to the left of the plot points of the helper series. Finally, format the markers of the helper series to have no fil and no line to make them invisible.
full - clearest image, shows the labels extending out the right of my plot
"zoomed" - highlighting why this is a problem as the plot becomes unreadable when selecting and plotting subset of the x-axis range
I'm working on some data where I have plotted a spectrum and have added vertical lines to specific positions. I have labelled these lines but my problem is that if I want to "zoom in" by decreasing my x axis range, the full list of labels for the vertical lines are still plotted resulting in an unreadable plot.
I iterate through a list of x positions and labels for my vertical lines and plot as follows:
for x_pos, label in zip(list_x_pos, list_label):
plt.axvline(x=x_pos)
plt.text(x_pos, y, str(label), rotation=90)
plt.xlim(2, 5)
So, because my "x values" go > 5 the resulting plot is a tiny figure with a row of the labels extending out from it.
The only solution I can think of is to slice my list_x_pos but this will crate other problems for me so ideally looking to find a way to just show the labels within the range of the plot.
Hope I've made sense!
Thanks,
Olie
You can use plt.text(..., clip_on=True) to force texts outside of the box to not be displayed.
Resize the axes first and then plot the vertical line.
I've made a chart with Excel 2010's "Combo" option for chart type so I can plot two data series for the same depth points. The image below shows the default, which is very close to what I want - except I would like to have the axes flipped so that the current X axis, which is depth, is displayed as the Y axis and both primary and secondary current Y axes plot as X axes. In other words, I'd like to rotate the chart area by 90 degrees clockwise. The "Switch Row/Column" doesn't do what I want (or expect) and I'm running out of both ideas and patience. Is there an easy fix? Or a hard fix?
Here's the plot as-is:
And here's a dummy plot of the end goal made by rotating the image around in Paint, in case the picture makes it clearer:
Finally, as was pointed out in the comments, the whole thing looks goofy and might be better plotted as a bar graph with two bars. I tried this as well and came away almost all set - but the gray bars plot from left to right and the blue bars plot from right to left. Seems like it should be as simple as changing the "Plot Series On" option to Primary Axis for both, but this destroys the graph.
I looked around and I think this link has instructions for what you're looking for: https://superuser.com/questions/188064/excel-chart-with-two-x-axes-horizontal-possible
I am trying to plot predictions vs observations in a scatter plot showing the predicted values in x and the observed in y, so a perfect fit should be shown in the diagonal. Is there any way to plot that diagonal in excel as a line, so it is easier to see if the result is close to the ideal? Also, my model has a standard error that I would also like to show as upper and lower line. Something like this:
Any ideas how I could add the lines in excel? Thanks !!
[edit]
This happens if I add a new series to draw the diagonal line as a line plot:
Where 'line 1' gives me what is shown in the center image after I add a new series, and 'line 2' the one of the right if I add the cells to a existing axis. What I'm doing wrong? thanks
Create a new series for each line, with just two points for each series.
For the diagonal, the first point is at the intersection of the axes and the second is at the top right of the charted area. Format the series with a suitable line and no data points.
For the upper and lower lines, same technique but the first point is where the line intersects the y or x axis respectively.
I want to get position(x,y) of a tick in x-axis of a graph to manual draw a line according it, please help me!
Please view below image to get my clearly question:
You can get the Y coordinate of all x-axis ticks like this: y = ActiveChart.Axes(xlValue).CrossesAt. In your example image, this will be 0.
The ticks on the x-axis will have X coordinates between ActiveChart.Axes(xlCategory).MinimumScale and ActiveChart.Axes(xlCategory).MaximumScale, both inclusive, at intervals of ActiveChart.Axes(xlCategory).MajorUnit.
Of course, if you know ahead of time which X value you want to highlight, then that X will be the X coordinate of the tick.
The above is assuming your chart is selected/activated. Instead of ActiveChart, you can use ActiveSheet.ChartObjects("Chart 1").Chart or whatever the correct reference to your chart is.
EDIT: Just realized that the example you show is a Line chart. It won't be possible to do what you're asking on a Line chart. You have to change the chart type to an XY (Scatter) chart first.