Hi all,
In the following CME, I set two renderers in two plots. If I put the second renderer in the first plot, the two ColorMapper are then equals!! cmap my_plot <enthought.chaco.color_mapper.ColorMapper object at 0x33e6530> cmap my_plot2 <enthought.chaco.color_mapper.ColorMapper object at 0x34a4590> plot container: {'my_plot2': [<enthought.chaco.colormapped_scatterplot.ColormappedScatterPlot object at 0x34a4890>], 'my_plot': [<enthought.chaco.colormapped_scatterplot.ColormappedScatterPlot object at 0x33e6650>]} ***** cmap my_plot <enthought.chaco.color_mapper.ColorMapper object at 0x34a4590> cmap my_plot2 <enthought.chaco.color_mapper.ColorMapper object at 0x34a4590> ******** What am I doing wrong???? TIA Cheers, -- Fred _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
On Thu, Jan 20, 2011 at 7:43 AM, Fred <[hidden email]> wrote:
> Hi all, > > In the following CME, I set two renderers in two plots. > > If I put the second renderer in the first plot, the two ColorMapper are then > equals!! > > cmap my_plot <enthought.chaco.color_mapper.ColorMapper object at 0x33e6530> > cmap my_plot2 <enthought.chaco.color_mapper.ColorMapper object at 0x34a4590> > plot container: {'my_plot2': > [<enthought.chaco.colormapped_scatterplot.ColormappedScatterPlot object at > 0x34a4890>], 'my_plot': > [<enthought.chaco.colormapped_scatterplot.ColormappedScatterPlot object at > 0x33e6650>]} Between here and the next print statement, you have a third plot.plot() call that overrides the my_plot2 plot with the first color_mapper. > ***** cmap my_plot <enthought.chaco.color_mapper.ColorMapper object at > 0x34a4590> cmap my_plot2 <enthought.chaco.color_mapper.ColorMapper object at > 0x34a4590> ******** > > What am I doing wrong???? -- Robert Kern Enthought _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
Le 20/01/2011 18:31, Robert Kern a écrit :
> Between here and the next print statement, you have a third > plot.plot() call that overrides the my_plot2 plot with the first > color_mapper. Sorry, Robert, I don't understand you :-/ I have two instances of Plot, each one with a renderer. I want to put the second Plot renderer in the first Plot. As color_mapper is an attribute of the renderer, and not the Plot itself, I don't understand why adding the second renderer overrides the color_mapper of the first renderer... In other words, how could I put two renderers with different color_mapper in a single Plot? TIA -- Fred _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
On Fri, Jan 21, 2011 at 3:28 AM, Fred <[hidden email]> wrote:
> Le 20/01/2011 18:31, Robert Kern a écrit : > >> Between here and the next print statement, you have a third >> plot.plot() call that overrides the my_plot2 plot with the first >> color_mapper. > Sorry, Robert, I don't understand you :-/ > > I have two instances of Plot, each one with a renderer. > > I want to put the second Plot renderer in the first Plot. > > As color_mapper is an attribute of the renderer, and not the Plot > itself, I don't understand why adding the second renderer overrides > the color_mapper of the first renderer... Ah. If you take a look at the implementation of Plot.plot(), you will see that cmap_scatter plots share the same color_mapper (just like all plots share the same index_mapper and value_mapper). > In other words, how could I put two renderers with different > color_mapper in a single Plot? You can explicitly add a Renderer using Plot.add_xy_plot(). This will bypass the extra machinery that you don't want. -- Robert Kern Enthought _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
Le 21/01/2011 16:21, Robert Kern a écrit :
> Ah. If you take a look at the implementation of Plot.plot(), you will > see that cmap_scatter plots share the same color_mapper (just like all > plots share the same index_mapper and value_mapper). Mmmh... I can have different color_mapper in one Plot. The issue just comes when added to the Plot container. But after, I can set different color_mapper in the same Plot. > >> In other words, how could I put two renderers with different >> color_mapper in a single Plot? > > You can explicitly add a Renderer using Plot.add_xy_plot(). This will > bypass the extra machinery that you don't want. Thanks!! I'll look at it asap! Cheers, -- Fred _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
In reply to this post by Robert Kern
Le 21/01/2011 16:21, Robert Kern a écrit :
>> In other words, how could I put two renderers with different >> color_mapper in a single Plot? > > You can explicitly add a Renderer using Plot.add_xy_plot(). This will > bypass the extra machinery that you don't want. The docstring says: Add a BaseXYPlot renderer subclass to this Plot. Parameters ---------- index_name : str The name of the index datasource. value_name : str The name of the value datasource. renderer_factory : callable The callable that creates the renderer. name : string (optional) The name of the plot. If None, then a default one is created (usually "plotNNN"). origin : string (optional) Which corner the origin of this plot should occupy: "bottom left", "top left", "bottom right", "top right" **kwds : Additional keywords to pass to the factory. But I don't understand how I can apply this to my example... :-/ TIA -- Fred _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
On Tue, Jan 25, 2011 at 5:28 AM, Fred <[hidden email]> wrote:
> Le 21/01/2011 16:21, Robert Kern a écrit : > >>> In other words, how could I put two renderers with different >>> color_mapper in a single Plot? >> >> You can explicitly add a Renderer using Plot.add_xy_plot(). This will >> bypass the extra machinery that you don't want. > > The docstring says: > > Add a BaseXYPlot renderer subclass to this Plot. > > Parameters > ---------- > index_name : str > The name of the index datasource. > value_name : str > The name of the value datasource. > renderer_factory : callable > The callable that creates the renderer. > name : string (optional) > The name of the plot. If None, then a default one is created > (usually "plotNNN"). > origin : string (optional) > Which corner the origin of this plot should occupy: > "bottom left", "top left", "bottom right", "top right" > **kwds : > Additional keywords to pass to the factory. > > But I don't understand how I can apply this to my example... :-/ plot.add_xy_plot('index2', 'value2', ColormappedScatterPlot, name = 'my_plot2', color_data = plot._get_or_create_datasource('color2'), color_mapper = cmap, marker = "circle", fill_alpha = 0.5, marker_size = 6, outline_color = "black", border_visible = True, bgcolor = "white") -- Robert Kern Enthought _______________________________________________ Enthought-Dev mailing list [hidden email] https://mail.enthought.com/mailman/listinfo/enthought-dev |
Free forum by Nabble | Edit this page |