Comprehensive guide to manipulating axes in idl - idl-programming-language

I am trying to have 4 plots in the same window using
!p.multi=[0,2,2]
!p.position=[0.11,0.5,0.5,0.9] ...some code
!p.position=[0.5,0.5,0.9,0.9] ...some code
!p.position=[0.11,0.1,0.5,0.5] ...some code
!p.position=[0.5,0.1,0.9,0.5] ...some code
The position of the plots is perfect (see graph here) but
a/ I would like to remove the scale on the x axis in the top 2 plots and have it at the top of the top plots rather than at the bottom.
b/ I would like to have the y axis on the right of the 2 plots on the right rather than on their left.
I have managed to do this kind of plot in the past but after hours playing with the [xy]style and axis commands. Part of the problem is that I can't find a comprehensive guide on the internet which would simple break down each style such that
xstyle = 1 ;definition
xstyle = 2 ; definition
...you get the jist of it.
Would somebody be able to refer me to a good guide on how to manipulate axes in idl so that I don't have to guess the styles each time I have to plot. If not, would somebody be able to break down the style and axis options / commands very simply on stack overflow? I doubt I'm the only one stumbling upon this problem time and time again...?
Thank you very much!

If you want to draw an axis on the "opposite side", you need to suppress the axis (i.e., [XY]AXIS=4) and then make the axis yourself in the correct location with the AXIS command.
The online help has definitions for the values of XSTYLE and the options to AXIS.

Related

ggplot with truncated axis, shortened secondary axis, and vertical lines that span multiple plots

I am writing a paper I plan to submit to an academic journal, and I want to use ggplot2 to follow a figure format similar to previous articles that use similar methods. I am trying to emulate the graph shown below, which has the following characteristics:
Axes with breaks that go 0 // next-number. It seems like guide_axis_truncated() (example post) could work, but most of the examples I see don't use the 0 // next-number notation that I'm looking for.
A secondary right-side axis that only extends partially up the height of each facet. I believe I can use guide_axis_truncated() for this, but I'd appreciate a sanity check on this and recommendations on combining this with the right-side axis.
Aligned axes and vertical dashed lines that extend across all facets. I found this post, but according to a comment, the solution might be outdated.
Here is a link to the full-text article if that helps.

Plot Order of plots and all drawn elements like line.new or label.new

It was my understanding that the plot order was the same as the occurrence in the code. So if I plotted a line on code line 23 it would be plotted before (and appear behind) a label that was defined from code line 98.
In a workaround to my last question, I am using a line set to 30 px and a transparency of 75 to create a fill. The problem is it is plotting over the top of labels that are defined much later in the code and because of their location should be plotting on top of the line, but they are not.
I have searched everywhere, pine manual vs 4, Kodafy, and here on Stack to find exactly what the output order of drawing, labels, line, and plots are.
If anyone knows the solution to my specific problem or where I can find the information resources to resolve it myself I would be very grateful.
Last Post referred to above: https://stackoverflow.com/questions/69236171/i-want-to-fill-between-two-extended-line-new-pine-script-is-not-having-it-√/69241461#69241461
Thanks, Michael
try adding this to you study() line:
explicit_plot_zorder = true
from the refman:
"explicit_plot_zorder (const bool) Specifies the order in which the indicator's plots, fills, and hlines are rendered. If true, the plots will be drawn based on the order in which they appear in the indicator's code, each newer plot being drawn above the previous ones. This only applies to plot*() functions, fill, and hline. Optional. The default is false."
Hope that can fix your problem
Cheers, and best of luck with your trading and coding

Spacing Between Multiple X-Axes in JFreeChart

I'm attempting to try and increase the vertical spacing between multiple x-axes using JFreeChart. Currently, my charts look like this:
Current chart
However, I need to produce something like the following so that the x-axes are more clearly defined (note that the vertical spacing between the x-axes is larger than in the first image):
Desired chart
Does any one have any idea on how to do this? I've been searching the JFreeChart API for > 2 days now and can't find anything that directly addresses the issue other than attempting to use org.jfree.chart.axis.AxisSpace in some way.
Many thanks for any help!
One approach would be to customise the axis label insets (that is, increase the space below each axis label).
http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/axis/Axis.html#setLabelInsets-org.jfree.ui.RectangleInsets-

In Stata, how do I modify axes of dot chart?

I'm trying to create a dot chart in Stata, splitting it into two categories
Running a chunk of code:
sysuse nlsw88, clear
drop if race == 3
graph dot (mean) wage, over(occ) by(race)
Creates such output:
So far so good but I'd like to remove labels of Y axis from the right graph to give the data some more space.
The only way I've been able to do that was to manually edit graph and hide the axis label object:
Is there a way to do it programmatically? I do know I could use one more over() but in some graphs of mine that is already taken.
I believe the solution is buried in help bystyle and help by_option. However, I can't get it to work with your example (I'm on Stata 12). But the description is clear. For example:
A bystyle determines the overall look of the combined graphs,
including
whether the individual graphs have their own axes and labels or if instead the axes and labels are shared across graphs arrayed in the
same row and/or in the same column;
...
There are options that let you control each of the above attributes --
see [G-3] by_option --
And also
iyaxes and ixaxes (and noiyaxes and noixaxes) specify whether the y axes and x axes are
to be displayed with each graph. The default
with most styles and
schemes is to place y axes on the leftmost graph of each row and to place x axes on
the bottommost graph of each column. The y and
x axes include the
default ticks and labels but exclude the axes titles.
If for some reason that doesn't work out, something like
sysuse nlsw88, clear
drop if race == 3
graph dot (mean) wage, over(occ) by(race)
gr_edit .plotregion1.grpaxis[2].draw_view.setstyle, style(no)
does (but I don't really like the approach). You can mess with at least the axis number [#] to do a bit of customization. I guess recording changes in the graphical editor and then recycling the corresponding code, may be one way out of difficult situations.

R plot axes don't meet and data extends beyond them

I have a VERY basic plot in R, and I'd like to solve two issues. Here is the code which produces the plot:
plot(o,n,bty="n",pch=21,cex=1.5,bg="gray",xlab="y",ylab="x",lwd=2)
And, here's the plot
There are two unwanted behaviors of this plot that I'm trying to fix. And I don't know how to do either one (nor do I understand why R doesn't do these things already...)
The X and Y axes do not meet. There is a gap near the origin in this plot. I want to remove that. The axes should touch, just like any other graph.
The data extends past the axis is both the X and Y direction. This clearly is unwanted. How can I fix this without having to manually make my own axis. Seems like there should be something more intuitive here.
bty="l".
You may also want to use something like:
xlim=c(0.02, 0.24), ylim=c(0.02, 0.24)
if you don't like the default limits of your two axes.
In general, check out ?par for guidance on both of these and many other options.
Try leaving out bty="n" or replacing it by bty="L" if you really do not want a box with edges above or on the right

Resources