Hi Pedro The easiest way to do this at the moment is something like wxPLplotstream* pls = plotwindow->GetStream(); pls->adv( 0 ); pls->scolbg(255, 255, 255); pls->clear(); //rest of your plotting code
If you have multiple subpages then you will need to do this on each page. Also if your subpages don't cover all the windows then you can call the SetBackgroundColour method of wxPLplotwindow and this will clear the whole window to the given colour initially. Hope that helps. If not then let me know. I'm very open to better ways to do this if you have suggestions. Phil On 6 October 2016 at 06:00, Pedro Vicente <pedro.vice...@space-research.org> wrote: > > so, there are at least 2 solutions for this : > 1) the quick is just to modify the PLplot source code , in the call to > > void wxPLplotstream::Create > > comment the call to > > //init(); > > then in our app code , do the init() call after Create() . as > > ~~~ > bool wxAppPlot::OnInit() > { > wxPLplotwindow<wxFrame> *frame = new wxPLplotwindow<wxFrame>(); > frame->Create(NULL, wxID_ANY, wxT("wxPLplot"), > wxDefaultPosition, > wxSize(900, 700)); > frame->Show(); > > //set background color (0) to white RGB(255,255,255) > //must be called before plinit() > plscolbg(255, 255, 255); > > wxPLplotstream* pls = frame->GetStream(); > pls->init(); > > //change color (0) to black RGB(0, 0, 0) > //must be called after plinit() > plscol0(0, 0, 0, 0); > > Plot(frame); > return true; > } > ~~~ > > > since it seems the only way to modiy the background color is to do the above > sequence > this is a change that I recommend to be included in the libray, since I > believe the other drivers require a call to init() too, but not the > wxWidgets driver. > > 2) not modifying the source code. In this case , I think it should be > possible to derive 2 classes , > a) one from wxPLplotwindow > b) other from wxPLplotwindow > > then do everything in those classes as now except the call to init() > > > but if the developers could do option 1) that probably would be the best > thanks > > > -Pedro > > > > > ----- Original Message ----- > From: Pedro Vicente > To: plplot-gene...@lists.sourceforge.net > Sent: Wednesday, October 05, 2016 6:42 PM > Subject: [Plplot-general] wxWidgets driver -- change the default > blackbackground > > Hi > > > I am trying to change the default black background color using the wxWidgets > driver > > If using the SVG driver this can be done as explained here > > https://sourceforge.net/p/plplot/mailman/message/2817799/ > > the trick being calling > > plscolbg() > > before > > plinit(); > > like the sample code below marked "SVG Driver" does > > > However for the wxWidegts driver , it seems we do not do a call to > > plinit(); > > but rather this is done inside the C++ stream initialization > > From the wxWidgets PLplot sample below > > the > > plinit(); > > is made inside > > > > frame->Create(NULL, wxID_ANY, wxT("wxPLplot")); > > > so I don't find a way to call the plscolbg() function before > > > How can this be accomplished ? > > > > > I also tried to modify the default colors of the default palette > > cmap0_default.pal > > 16 > #000000 > > so that the first is white > > this does work *but* only after the window is redrawn (it first shows the > default red on black); > this seems like a bug to me > > > Also, what's the call to increase the font size? > On the wxWidgets driver the font looks tiny > > Thanks ! > > > Sample code wxWidgets > > > > bool > > wxAppPlot::OnInit() > > { > > wxPLplotwindow<wxFrame> *frame = new wxPLplotwindow<wxFrame>(); > > frame->Create( > > NULL, wxID_ANY, wxT("wxPLplot")); > > frame->Show(); > > Plot(frame); > > return true; > > } > > ///////////////////////////////////////////////////////////////////////////////////////////////////// > > //Plot > > ///////////////////////////////////////////////////////////////////////////////////////////////////// > > template > > < class WXWINDOW > > > void > > Plot(wxPLplotwindow<WXWINDOW> *plotwindow) > > { > > wxPLplotstream* pls = plotwindow->GetStream(); > > //render > > plotwindow->RenewPlot(); > > } > > > > > Sample code SVG driver > > void > > atms_dwell_granu_t::plot() > > { > > //set SVG device and output file name > > plsdev("svg"); > > plsfnam("atms_dwell_granu.svg"); > > //set background color (0) to white RGB(255,255,255) > > //must be called before plinit() > > plscolbg(255, 255, 255); > > //initialize plplot > > plinit(); > > //change color (0) to black RGB(0, 0, 0) > > //must be called after plinit() > > plscol0(0, 0, 0, 0); > > ///////////////////////////////////////////////////////////////////////////////////////////////////// > > //render > > ///////////////////////////////////////////////////////////////////////////////////////////////////// > > PLFLT xmin, xmax, ymin, ymax; > > PLFLT *x, *y; > > const int NSIZE = iOrbit_all; > > xmin = 0; > > xmax = NSIZE; > > ymin = -1.0; > > ymax = 6.0; > > x = > > new PLFLT[NSIZE]; > > y = > > new PLFLT[NSIZE]; > > plcol0(0); > > plenv(xmin, xmax, ymin, ymax, 0, 0); > > pllab("", "Current (Amps)", "Scan Drive Main Motor Current"); > > //time axis > > for (int idx_orb = 0; idx_orb < NSIZE; idx_orb++) > > { > > x[idx_orb] = idx_orb; > > } > > //mean > > for (int idx_orb = 0; idx_orb < NSIZE; idx_orb++) > > { > > y[idx_orb] = DWELL_SAMPLE_APID517_Orbit[0][TLM_NUM_ORBIT - 1][idx_orb]; > > } > > plpoin(NSIZE, x, y, 46); > > plend(); > > delete[] x; > > delete[] y; > > } > > ________________________________ > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > > ________________________________ > > _______________________________________________ > Plplot-general mailing list > plplot-gene...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/plplot-general > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Plplot-devel mailing list > Plplot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/plplot-devel > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel