Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. QwtPlot zooming logarithmic scale

QwtPlot zooming logarithmic scale

Scheduled Pinned Locked Moved 3rd Party Software
qwtwidgetlogarithmicscalezoom
2 Posts 2 Posters 4.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HappyCoder
    wrote on last edited by
    #1

    zoscHello,

    i have a QwtPlot with a logarithmic scale on y and time scale on x. That was not the problem, but zooming into the graph.
    I have three unwanted effects, but don't know how to fix:

    1. when use wheel mouse to zoom in i can see on my y-axes only 1000 no other values.
    2. when i zoom out my y-axes goes down to 1E-100 ?
    3. when i use ctrl+LeftMouse to open the RubberBandPan to zoom from 400 to 1000 mbar, i see a lot of values of the y-axes
      from 440 to 1000 every 20 mbar.
    4. when i zoom into 1e-5 to 1e-6 dosen't work, i see y-axes range from 0,01 to 1e-100 ?

    Thx for you help

    QwtLogScaleEngine* axesy = new QwtLogScaleEngine();
    ui->plot->setTitle("Plot");
    ui->plot->setAxisTitle(QwtPlot::yLeft,QString("Pressure [%1]").arg(QString("mbar")));
    ui->plot->setAxisTitle(QwtPlot::xBottom,QString("Time [%1]").arg(QString("s")));
    ui->plot->setAxisScaleEngine(QwtPlot::yLeft, axesy);
    ui->plot->setAxisMaxMajor( QwtPlot::yLeft, 100);
    ui->plot->setAxisMaxMinor( QwtPlot::yLeft, 10);
    ui->plot->setAxisScale(QwtPlot::yLeft,1e-10,2000);
    
    // Setting Magnifier
    QwtPlotMagnifier* zoom_x = new QwtPlotMagnifier(ui->plot->canvas());
    QwtPlotMagnifier* zoom_y = new QwtPlotMagnifier(ui->plot->canvas());
    // Shift+MouseWheel --> Magnifier x
    zoom_x->setWheelModifiers(Qt::ShiftModifier);
    zoom_x->setAxisEnabled(QwtPlot::xBottom, true);
    zoom_x->setAxisEnabled(QwtPlot::yLeft, false);
    // CTRL + MouseWheel --> Magnifier y
    zoom_y->setWheelModifiers(Qt::ControlModifier);
    zoom_y->setAxisEnabled(QwtPlot::xBottom,false);
    zoom_y->setAxisEnabled(QwtPlot::yLeft,true);
    
    // Left Button for panning
    QwtPlotPanner* panner = new QwtPlotPanner (ui->plot->canvas());
    panner->setMouseButton(Qt::LeftButton);
    
    //QwtPlotZoomer* zoomer = new QwtPlotZoomer( ui->plot->canvas() );
    QwtPlotZoomer* zoomer = new QwtPlotZoomer( QwtPlot::xBottom, QwtPlot::yLeft, ui->plot->canvas()  );
    zoomer->setRubberBandPen( QColor( Qt::black ) );
    zoomer->setTrackerPen( QColor( Qt::red ) );
    // CTRL+LeftButton for the zooming
    zoomer->setMousePattern( QwtEventPattern::MouseSelect1, Qt::LeftButton, Qt::ControlModifier);
    // CTRL+RightButton back to full size
    zoomer->setMousePattern( QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
    
    QwtPlotGrid *grid = new QwtPlotGrid();
    grid->enableY(true);
    grid->enableYMin(true);
    grid->setMajorPen( Qt::darkGray, 0, Qt::SolidLine );
    grid->setMinorPen( Qt::gray, 0 , Qt::DotLine );
    grid->attach(ui->plot);
    
    QwtLegend* legend = new QwtLegend;
    legend->setDefaultItemMode(QwtLegendData::Checkable);
    ui->plot->insertLegend(legend,QwtPlot::RightLegend);
    
    K 1 Reply Last reply
    0
    • H HappyCoder

      zoscHello,

      i have a QwtPlot with a logarithmic scale on y and time scale on x. That was not the problem, but zooming into the graph.
      I have three unwanted effects, but don't know how to fix:

      1. when use wheel mouse to zoom in i can see on my y-axes only 1000 no other values.
      2. when i zoom out my y-axes goes down to 1E-100 ?
      3. when i use ctrl+LeftMouse to open the RubberBandPan to zoom from 400 to 1000 mbar, i see a lot of values of the y-axes
        from 440 to 1000 every 20 mbar.
      4. when i zoom into 1e-5 to 1e-6 dosen't work, i see y-axes range from 0,01 to 1e-100 ?

      Thx for you help

      QwtLogScaleEngine* axesy = new QwtLogScaleEngine();
      ui->plot->setTitle("Plot");
      ui->plot->setAxisTitle(QwtPlot::yLeft,QString("Pressure [%1]").arg(QString("mbar")));
      ui->plot->setAxisTitle(QwtPlot::xBottom,QString("Time [%1]").arg(QString("s")));
      ui->plot->setAxisScaleEngine(QwtPlot::yLeft, axesy);
      ui->plot->setAxisMaxMajor( QwtPlot::yLeft, 100);
      ui->plot->setAxisMaxMinor( QwtPlot::yLeft, 10);
      ui->plot->setAxisScale(QwtPlot::yLeft,1e-10,2000);
      
      // Setting Magnifier
      QwtPlotMagnifier* zoom_x = new QwtPlotMagnifier(ui->plot->canvas());
      QwtPlotMagnifier* zoom_y = new QwtPlotMagnifier(ui->plot->canvas());
      // Shift+MouseWheel --> Magnifier x
      zoom_x->setWheelModifiers(Qt::ShiftModifier);
      zoom_x->setAxisEnabled(QwtPlot::xBottom, true);
      zoom_x->setAxisEnabled(QwtPlot::yLeft, false);
      // CTRL + MouseWheel --> Magnifier y
      zoom_y->setWheelModifiers(Qt::ControlModifier);
      zoom_y->setAxisEnabled(QwtPlot::xBottom,false);
      zoom_y->setAxisEnabled(QwtPlot::yLeft,true);
      
      // Left Button for panning
      QwtPlotPanner* panner = new QwtPlotPanner (ui->plot->canvas());
      panner->setMouseButton(Qt::LeftButton);
      
      //QwtPlotZoomer* zoomer = new QwtPlotZoomer( ui->plot->canvas() );
      QwtPlotZoomer* zoomer = new QwtPlotZoomer( QwtPlot::xBottom, QwtPlot::yLeft, ui->plot->canvas()  );
      zoomer->setRubberBandPen( QColor( Qt::black ) );
      zoomer->setTrackerPen( QColor( Qt::red ) );
      // CTRL+LeftButton for the zooming
      zoomer->setMousePattern( QwtEventPattern::MouseSelect1, Qt::LeftButton, Qt::ControlModifier);
      // CTRL+RightButton back to full size
      zoomer->setMousePattern( QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
      
      QwtPlotGrid *grid = new QwtPlotGrid();
      grid->enableY(true);
      grid->enableYMin(true);
      grid->setMajorPen( Qt::darkGray, 0, Qt::SolidLine );
      grid->setMinorPen( Qt::gray, 0 , Qt::DotLine );
      grid->attach(ui->plot);
      
      QwtLegend* legend = new QwtLegend;
      legend->setDefaultItemMode(QwtLegendData::Checkable);
      ui->plot->insertLegend(legend,QwtPlot::RightLegend);
      
      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @HappyCoder

      Out of personal experience I recommend also to ask your question on QWT mailing list
      AFAIK QWT is still independent and only based on Qt libs. Uwe has been monitoring this forum in the past, but answers are potentially faster through QWT mailing list.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved