MATLAB: why would an axis have its position property changed? - graphics

I'm working on a custom plot on top of which I add a second blank axis object to show a secondary scale on the right hand side of the graph (as well as the primary scale on the left hand side).
Works great (and had been, for years), until I tried it again recently in R2010a and for some reason the primary axis gets its Position property tweaked when the figure is resized or printed, so that it looks OK on the screen at first, but when I print it or resize the figure, the two axes don't line up vertically.
What would do this, and how can I set it up so the two axes maintain the same position?

aha: I think I found it:
http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f1-32495.html
Controlling Axes Size
When you create a graph, MATLAB automatically creates an axes to display the graph. The axes is sized to fit in the figure and automatically resizes as you resize the figure. However, MATLAB applies the automatic resize behavior only when the axes Units property is set to normalized (the default).
Note: MATLAB changes only the current axes' properties by default. If your plot has multiple axes, MATLAB will not automatically resize any secondary axes.
You can control the resize behavior of the axes using the following axes properties:
...
ActivePositionProperty — Specifies whether to use the OuterPosition or the Position property as the size to preserve when resizing the figure containing the axes.

You may find the linkprop function helpful

Related

'Shape' legend only created for first plot of a group

I have a plot of 6 charts which are generated by loop in an identical fashion (only the sites plotted changes). The plots are then joined:
chart= plot_group_0 & plot_group_1 ... etc.
However the secondary legend detail designating the ‘Interval’ at the top right only appears for the first plot.
This ‘Interval’ legend is automatically generated by the ‘shape’ feature.
shape=alt.Shape('interval:N',title='Interval'),
Is there a way to explicitly force it to appear for each plot? The relevant 'shape' line is obviously executed for each plot in the loop so I'm not sure why it only appears once.
Concatenated charts share their legends and scales by default. If you want legends or scales to be independent, you can set the resolve property, as discussed in Scale and Guide Resolution
To share the scale but use independent legends, use:
chart = plot_group_0 & plot_group_1 #... etc
chart = chart.resolve_legend(shape='independent')
To have independent scales as well as independent legends, use
chart = chart.resolve_scale(shape='independent')

Vertical axis on Excel plot extends beyond where it's supposed to?

I ran into this interesting "feature" while plotting something in Excel (Office 365 ProPlus, Version 1705, Build 8201.2200). The plot is shown below, with the other axes removed.
The vertical axis is supposed to extend from 0.0 to 1.0E-12, and it does -- as far as the vertical is concerned. There is an additional value of 1.2E-13 that seems to be floating out there for no reason. The same thing happens if I set the vertical axis Bounds to "Auto".
Interestingly, if I delete the orange curve (whose maximum value is well within the current vertical axis), the vertical axis values seem to correctly snap to their proper positions:
What is going on, and how can I fix this error? Is it a bug, or do I have a box checked that I shouldn't have checked?

Flip X and Y axis on Excel custom chart

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

How to plot Bubble chart with plots outside axis area using Excel

Im using Excel for Mac 2011 and I have the following figure
I would like to still show the bubbles outside of the available chart area, while keeping the maximum and minimum axes values unchanged.
Create an identical chart with the same data, but with axis limits that show the full bubbles. Then set all the formatting in the chart other than the bubbles to the equivalent of "none", i.e, no axis labels, chart outlines, gridlines, chart and plot borders, background color, etc.
With very careful sizing and positioning of this bubbles-only chart over the original chart, you can get the bubbles to extend beyond the plot area of the original. If the size or position of a bubble is a little off, modify the overlay chart's data by the tiny amount needed to get the bubble to cover the underlying original bubble. Turn off the formatting for the underlying bubbles as last step.
NOT programmatic, very trial and error, and fussy, of course, and I hope someone comes up with a more elegant way to achieve your goal. But I was able to get it to work on my Windows machine.

Draw axis thru x=0 and y=0

I have a set of data that I'm plotting as a scatter graph which has both positive and negative values on both axis. When I plot this in Flot, the axis are draw at the bottom and the left by default. Is there a way to make it draw the axis through the center of the graph? #X=0 and Y=0?
In other words, instead of this:
I want something like this:
That isn't possible in the default flot. I'm sure it could be hacked in if you wanted to dig into the source, but flot by itself only supports left/right for the y-axis, and top/bottom for the x-axis.
In case anybody else comes across the same need, I created a plugin for Flot and put it here:
https://github.com/burlandm/Flot-Origin-Axis
It does what I need, but I won't make any promises that it'll fit your particular scenario. If I have time, I might try and update it to cover more scenarios.

Resources