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

Reply via email to