Warum klappt es nicht in einer Definition
TwoAxisPlot[{f_,g_},{x_,x1_,x2_},Type_StringMatchQ[Type_,"Plot"|"LogPlot"|"LogLogPlot"]]:=Module[..
zu verwenden???
fragt Peter und sagt Danke für die Antwort...
Anhang
Mit Auskommentieren geht es:
TwoAxisPlot//ClearAll
TwoAxisPlot[{f_,g_},{x_,x1_,x2_},Type_(*
*StringMatchQ[Type_,"Plot"|"LogPlot"|"LogLogPlot"]**)
]:=Module[{fgraph,ggraph,frange,grange,fticks,gticks},
{fgraph,ggraph}=Which[
Type=="Plot",MapIndexed[Plot[#,{x,x1,x2},Axes->True,PlotStyle->ColorData[1][#2[[1]]]]&,{f,g}],Type=="LogPlot",MapIndexed[LogPlot[#,{x,x1,x2},Axes->True,PlotStyle->ColorData[1][#2[[1]]]]&,{f,g}],Type=="LogLogPlot",MapIndexed[LogLogPlot[#,{x,x1,x2},Axes->True,PlotStyle->ColorData[1][#2[[1]]]]&,{f,g}]];{frange,grange}=(PlotRange/.AbsoluteOptions[#,PlotRange])[[2]]&/@{fgraph,ggraph};fticks=N@FindDivisions
[frange,5];
gticks=Quiet@Transpose
@{fticks,ToString[NumberForm[#,2],StandardForm]&/@Rescale[fticks,frange,grange]};
Show[fgraph,ggraph/.Graphics[graph_,s___]:>Graphics[GeometricTransformation[graph,RescalingTransform[{{0,1},grange},{{0,1},frange}]],s],Axes->False,Frame->True,FrameStyle->{ColorData[1]/@{1,2},{Automatic,Automatic}},FrameTicks->{{fticks,gticks},{Automatic,Automatic}}]]
TwoAxisPlot[{Cos[x]+100,Sin[x]+100},{x,-2,2},"Plot"]
TwoAxisPlot[{Cos[x]+100,Sin[x]+100},{x,-2,2},"LogPlot"]
TwoAxisPlot[{Cos[x]+100,Sin[x]+100},{x,-2,2},"LogLogPlot"]
_______________________________________________
DMUG Deutschsprachiges Mathematica-Forum demug@XXXXXXX.ch
http://www.mathematica.ch/mailman/listinfo/demug
Archiv: http://www.mathematica.ch/archiv.html