@@ -567,7 +567,7 @@ def show(
567567 ]
568568
569569 # prepare rendering params
570- render_cmds = OrderedDict ()
570+ render_cmds = []
571571 for cmd , params in plotting_tree .items ():
572572 # strip prefix from cmd and verify it's valid
573573 cmd = "_" .join (cmd .split ("_" )[1 :])
@@ -577,9 +577,9 @@ def show(
577577
578578 if "render" in cmd :
579579 # verify that rendering commands have been called before
580- render_cmds [ cmd ] = params
580+ render_cmds . append (( cmd , params ))
581581
582- if len (render_cmds . keys () ) == 0 :
582+ if len (render_cmds ) == 0 :
583583 raise TypeError ("Please specify what to plot using the 'render_*' functions before calling 'imshow()'." )
584584
585585 if title is not None :
@@ -609,7 +609,7 @@ def show(
609609 # Check if user specified only certain elements to be plotted
610610 cs_contents = _get_cs_contents (sdata )
611611 elements_to_be_rendered = []
612- for cmd , params in render_cmds . items () :
612+ for cmd , params in render_cmds :
613613 if cmd == "render_images" and cs_contents .query (f"cs == '{ cs } '" )["has_images" ][0 ]: # noqa: SIM114
614614 if params .elements is not None :
615615 elements_to_be_rendered += (
@@ -632,13 +632,14 @@ def show(
632632 )
633633
634634 # filter out cs without relevant elements
635+ cmds = [cmd for cmd , _ in render_cmds ]
635636 coordinate_systems = _get_valid_cs (
636637 sdata = sdata ,
637638 coordinate_systems = coordinate_systems ,
638- render_images = "render_images" in render_cmds ,
639- render_labels = "render_labels" in render_cmds ,
640- render_points = "render_points" in render_cmds ,
641- render_shapes = "render_shapes" in render_cmds ,
639+ render_images = "render_images" in cmds ,
640+ render_labels = "render_labels" in cmds ,
641+ render_points = "render_points" in cmds ,
642+ render_shapes = "render_shapes" in cmds ,
642643 elements = elements_to_be_rendered ,
643644 )
644645
@@ -689,7 +690,7 @@ def show(
689690 wants_shapes = False
690691 wanted_elements = []
691692
692- for cmd , params in render_cmds . items () :
693+ for cmd , params in render_cmds :
693694 if cmd == "render_images" and has_images :
694695 wants_images = True
695696 wanted_images = params .elements if params .elements is not None else list (sdata .images .keys ())
0 commit comments