@@ -626,33 +626,11 @@ function CSMakie.nicholsplot(systems::Union{LTISystem, AbstractVector{<:LTISyste
626626 return fig
627627end
628628
629- # ====== Recipes for Types (SimResult, StepInfo) ======
630- # These use Makie's standard recipe system for plotting types
629+ # ====== Direct plot methods for types ======
630+ # These allow direct plotting of types with plot()
631631
632- @recipe (SimResultPlot, r) do scene
633- Attributes (
634- plotu = false ,
635- plotx = false ,
636- ploty = true ,
637- )
638- end
639-
640- function Makie. plot! (srp:: SimResultPlot )
641- r = srp. r[]
642-
643- # Handle vector of SimResults
644- if r isa AbstractVector
645- for res in r
646- plot! (current_axis (), res;
647- plotu= srp. plotu[], plotx= srp. plotx[], ploty= srp. ploty[])
648- end
649- return srp
650- end
651-
652- plotu = srp. plotu[]
653- plotx = srp. plotx[]
654- ploty = srp. ploty[]
655-
632+ # Direct plot method for SimResult
633+ function Makie. plot (r:: SimResult ; plotu= false , plotx= false , ploty= true )
656634 ny, nu, nx = r. ny, r. nu, r. nx
657635 t = r. t
658636 n_series = size (r. y, 3 )
@@ -662,10 +640,8 @@ function Makie.plot!(srp::SimResultPlot)
662640 plotu && (nplots += nu)
663641 plotx && (nplots += nx)
664642
665- # Get current figure or create new one
666- fig = current_figure ()
667-
668- # Create grid layout for subplots
643+ # Create figure with grid layout
644+ fig = Figure ()
669645 gl = GridLayout (fig[1 , 1 ])
670646
671647 plotind = 1
@@ -740,17 +716,16 @@ function Makie.plot!(srp::SimResultPlot)
740716 linkxaxes! (axes... )
741717 end
742718
743- srp
744- end
745-
746- @recipe (StepInfoPlot, si) do scene
747- Attributes ()
719+ return fig
748720end
749721
750- function Makie. plot! (sip:: StepInfoPlot )
751- si = sip. si[]
752-
753- ax = current_axis ()
722+ # Direct plot method for StepInfo
723+ function Makie. plot (si:: StepInfo )
724+ fig = Figure ()
725+ ax = Axis (fig[1 ,1 ],
726+ xlabel = " Time (s)" ,
727+ ylabel = " Output" ,
728+ title = " Step Response Analysis" )
754729
755730 # Plot the step response
756731 t = si. res. t
@@ -793,13 +768,9 @@ function Makie.plot!(sip::StepInfoPlot)
793768 lines! (ax, [t_under, t_under], [si. y0, si. lowerpeak], color= :orange , alpha= 0.5 )
794769 end
795770
796- ax. xlabel = " Time (s)"
797- ax. ylabel = " Output"
798- ax. title = " Step Response Analysis"
799-
800771 axislegend (ax, position= :rt )
801772
802- sip
773+ return fig
803774end
804775
805776end # module
0 commit comments