From: Pedro V. <ped...@sp...> - 2016-10-05 22:42:19
|
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; } |