@Override
    public void paint(Graphics g) {
        //super.paint(g); //To change body of generated methods, choose Tools | Templates.
        if (isDirty) {
            try {
                graph(lastPlot);
                g.drawImage(img, 0, 25, this);
            } catch (InterruptedException ex) {
                Logger.getLogger(GNUPlot.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(GNUPlot.class.getName()).log(Level.SEVERE, null, ex);
            } catch (URISyntaxException ex) {
                Logger.getLogger(GNUPlot.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }