Re: [Plplot-general] plplot-wxwidgets-plotting

2018-05-03 Thread Alan W. Irwin

On 2018-05-03 13:56-0400 David Bergman wrote:

P.S. I noticed just after (natch) I sent off my previous post that you
had included source code in your post, but it is hard for me to
evaluate whether you have simplified that example as much as possible.

So here is what I would like you to do instead. Please give us the
simplest possible patch for examples/c++/wxPLplotDemo.cpp that
demonstrates the issue. Such a patch clearly demonstrates the minimal
changes required to show the issue.  It also should allow our current
build and test system to build and test your (slight) modification of
examples/c++/wxPLplotDemo.cpp, and that would be a great convenience
for us when we are attempting to replicate the issue on our various
platforms.

Alan
__
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__

Linux-powered Science
__

--
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-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general


[Plplot-general] plplot-wxwidgets-plotting

2018-05-03 Thread David Bergman

Dear all,

I am using plplot 5.13.0 and wxwidgets 3.1.0 in a windows environment, 
VS 2017.
I've attempted to merge the plplot wxwidgets example with more complex 
wxwidgets examples to generate plots in various frames and panels in a 
larger GUI format.


The specific example that produced the figures in this email were made 
using wxWidgets uiaction sample (UI action simulator) and the 
WxPLplotDemo code.


In a nut shell I've made a splitter window in the main GUI and placed a 
copy of one of the plots there via a call to Plot() in the mainframe 
definition.  The same plot is called for some menu action too.


The issue I am seeing is that the plot in the main GUI does not have 
axis labels or tick mark values but the separate plot, activated by the 
menu does.


Also, if I refresh the plot in the gui via a separate menu action the 
missing data returns.


All calls are to the same function.  I'm asking here first since it's 
the plot generated by PLplot that is inconsistency but it may be a 
wxwidgets issue.


(it is clear that I was messing with other PLplot attributes too, like 
subplot, color, etc.  This was not the cause of the difference as it is 
present regardless.)  Modified code is attached (note that the "run 
simulation" menu item will cause a crash.), it is a quick hack job but 
I'm not seeing an obvious cause for the diff.


This is the main frame GUI


This is the separate plot generated in a new frame.





---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"

#ifdef __BORLANDC__
#pragma hdrstop
#endif

// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWidgets headers)
#ifndef WX_PRECOMP
#include "wx/wx.h"
#include "wx/log.h"

#include "wx/app.h"
#include "wx/frame.h"

#include "wx/scrolwin.h"
#include "wx/menu.h"
#include "wx/textctrl.h"
#include "wx/textdlg.h"  
#endif

#if wxUSE_UIACTIONSIMULATOR
#include "wx/uiaction.h"
#endif

#include "wx/wx.h"
#include "wx/app.h"
#include "wx/frame.h"

#include "wx/scrolwin.h"
#include "wx/menu.h"
#include "wx/textctrl.h"
#include "wx/textdlg.h"
#include "wx/intl.h"
#include "wx/file.h"
#include "wx/log.h"
#include "wx/cmdline.h"
#include "wx/calctrl.h"
#include "wx/splitter.h"
#include "wx/dcmirror.h"

// 
// resources
// 

// the application icon (under Windows it is in resources and even
// though we could still include the XPM here it would be unused)
#ifndef wxHAS_IMAGES_IN_RESOURCES
#include "../sample.xpm"
#endif


//*
// Cut from wxPLplotDemo
//*

#include "wxPLplotwindow.h"
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;

#define MAX( a, b )( ( a ) < ( b ) ? ( b ) : ( a ) )
#define MIN( a, b )( ( a ) < ( b ) ? ( a ) : ( b ) )
//*

// 
// constants
// 

// IDs for the controls and the menu commands
enum
{
// menu items
RunSimulation = 1,
SimulateText
};

// 
// private classes
// 

//*
//  Cut from wxPLplotDemo
//*
template< class WXWINDOW >
void Plot(wxPLplotwindow *plotwindow);

class wxPlFrame : public wxPLplotwindow   //
{
public:
wxPlFrame(const wxString );
private:
virtual void OnLocate(const PLGraphicsIn );
void OnIdle(wxIdleEvent );
virtual void plot();
bool m_plotted;
};

wxPlFrame::wxPlFrame(const wxString )
{
Create(NULL, wxID_ANY, title);
   //give our 
frame a nice icon
Connect(wxEVT_IDLE, wxIdleEventHandler(wxPlFrame::OnIdle));
m_plotted = false;
}

void wxPlFrame::OnIdle(wxIdleEvent )
{
//We do our plotting in here, but only the first time it is called
//This allows us to keep checking if the window is ready and only
//plot if it is.
if (!m_plotted && IsReady())
{
m_plotted = true;
plot();
}
}

void wxPlFrame::plot()
{
if (!IsReady())
{
wxMessageBox(wxT("Somehow we attempted to plot before the 
wxPLplotwindow was ready. The plot will not be drawn."));
return;
}
wxPLplotstream* pls = GetStream();
PLPLOT_wxLogDebug("wxPlDemoFrame::plot()");
assert(pls);

const size_t np = 500;
PLFLT