RE: Offending 2D-Axes
- To: mathgroup at smc.vnet.net
- Subject: [mg44228] RE: [mg44207] Offending 2D-Axes
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 29 Oct 2003 03:34:10 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Bruce, Here is a routine that will produce your kind of plot. It doesn't automatically apply but must be used on each plot. You could Unprotect the plot statements and redefine them to include the OffendingAxisPlot command, but I certainly don't recommend doing that. Attributes[OffendingAxisPlot] = {HoldFirst}; OffendingAxisPlot[plotstatement_] := Module[ {plot, axes, offendingstyle}, plot = Block[{$DisplayFunction = Identity}, plotstatement]; axes = AxesOrigin /. AbsoluteOptions[plot, AxesOrigin] // Reverse; offendingstyle = If[# == 0, {Automatic}, {AbsoluteDashing[{5}]}] & /@ axes; Show[plot1, AxesStyle -> offendingstyle] ] I don't think it's a great idea. For example, is this what you wanted? Plot[10 - (x - 30)^2, {x, 20, 40}] // OffendingAxisPlot I think that in general it is not possible to make special routines that will do useful special manipulations on a large class of plots, unless they are all quite similar. Every plot must be tailored to present its information in the most effective manner. What works for one case may be horrible for another case. So it is far better to just take control of the elements of the plot yourself, which Mathematica allows you to do, and not write some routine that will impose some special style on all plots. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Bruce W. Colletti [mailto:bcolletti at compuserve.com] To: mathgroup at smc.vnet.net David Thanks for the reply. I must clarify the too-terse original posting. When 2D-plotted axes don't intersect at (0,0), let's leave the display untouched EXCEPT for dashing the axis that's neither x=0 nor y=0 (the "offending" axis). Although this can be done for any specific plot, is there a general way to auto-detect when the displayed origin isn't (0,0) and if so, dash the offending axis (or axes)? Perhaps a startup package that maintains vigilence, or maybe creating a $Post statement? Bruce > You don't have to have any axes that are "offending"! You can control the > axes with the plot options Axes, AxesOrigin and AxesStyle. Look these up in > Help. You may also wish to use Frame. You can have a Frame and Axes inside > the Frame. Here is an example. > > Plot[10 - (x - 7)^2, {x, 0, 14}, > Frame -> True, > AxesOrigin -> {7, 0}, > AxesStyle -> {{Automatic}, {AbsoluteDashing[{5}]}}]; > > Plot options are very important for making a graph have the overall look > that you desire. > > David Park