create a plot with two y-axes - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Graphics : Packages : plots : plots/dualaxisplot

plots[dualaxisplot] - create a plot with two y-axes

Calling Sequence

dualaxisplot(expr1, expr2, xrange, opts)

dualaxisplot(p1, p2, mopts)


expr1, expr2


expressions or procedures



x-range specification

p1, p2


PLOT structures created by Maple plotting commands



(optional) plotting options to be passed to the plot command



(optional) plotting options to be merged with PLOT structures.



The dualaxisplot command creates a plot with two y-axes located at the left and right sides of the plot.  The y-axis at the left is considered the primary axis and is associated with the first plot given in the calling sequence.


In the first calling sequence, expr1 and expr2 are two expressions or procedures.  Each expression or procedure is passed to the plot command, along with the x-range specification and any plotting options, to create the plot objects in the dual-axis plot.


Plot options as described on the plot/options help page may be given with the first calling sequence.  A limited number of options (axis[2], color, legend, linestyle, symbol, symbolsize, thickness and transparency) may be given a list of two values. For example, thickness = [1, 2] means apply thickness = 1 to the first expression and thickness = 2 to the second.  Note that each value for the axis[2] option must itself be a list, as described on the plot/axis help page.


In the second calling sequence, p1 and p2 are PLOT structures generated by Maple plotting commands.  This calling sequence is particularly useful when you wish to combine plots created with commands other than the plot command, such as the plots[display] or plots[animate] commands.


Options may be provided with the second calling sequence as well. Because this calling sequence uses fully formed PLOT structures, the new options are merged into the structures using the plots[display] command. Most of the options described on the plot/options page are allowed but, unlike the first calling sequence, only single values may be given. If different option values are desired for each plot, they should be specified when the individual plot structures are being created. Note that additional options are not merged with animations.


Plots generated by the dualaxisplot command may be combined using the plots[display] command.  Elements associated with the left y-axis in both plots are grouped together in the new plot, and similarly for elements associated with the right y-axis.  If a dual-axis plot is combined with a regular plot, then the elements of the regular plot are associated with the left y-axis in the resulting plot.


If the two plots have options that conflict, such as two different titles, then the option associated with the primary plot (the one associated with the left y-axis) is used. When constrained scaling is requested, it is also applied to the primary plot.


Dual-axis plots are not available for all interfaces and devices. For more information, see plot/interface.






dualaxisplotplotx2,x=0..10,labels=x,x2,legend=x2,plotx3,x=0..10,color=blue,labels=x,x3,legend=x3,title=A Comparison



The command to create the plot from the Plotting Guide is


See Also

plot, plot/interface, plots[display]

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam