本文整理汇总了C++中replot函数的典型用法代码示例。如果您正苦于以下问题:C++ replot函数的具体用法?C++ replot怎么用?C++ replot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了replot函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QwtPlot
EcgCh::EcgCh(QWidget *parent) :
QwtPlot(parent)
{
setMinimumHeight(10);
setMinimumWidth(10);
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
grid->attach(this);
setAxisTitle(QwtPlot::xBottom, "Czas [hh:mm:ss.ms]");
setAxisTitle(QwtPlot::yLeft, "Amplituda [mV]");
// picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft, QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn, canvas());
// picker->setStateMachine(new QwtPickerDragPointMachine());
// picker->setRubberBandPen(QColor(Qt::green));
// picker->setRubberBand(QwtPicker::CrossRubberBand);
// picker->setTrackerPen(QColor(Qt::white));
curve = new QwtPlotCurve("signal");
curve->setYAxis(QwtPlot::yLeft);
curve->attach(this);
peaksCurve = new QwtPlotCurve("signal");
peaksCurve->setYAxis(QwtPlot::yLeft);
peaksCurve->setStyle(QwtPlotCurve::CurveStyle::Dots);
peaksCurve->setPen(QPen(Qt::red, 5));
peaksCurve->attach(this);
samples = new QVector<QPointF>;
data = new QwtPointSeriesData;
peaksSamples = new QVector<QPointF>;
peaksData = new QwtPointSeriesData;
replot();
}
示例2: sensor_callback
void Plot::timerEvent( QTimerEvent * )
{
circular_buffer.pop_back();
double data = sensor_callback();
circular_buffer.push_front(data);
d_curve->setSamples(x_sample, circular_buffer);
replot();
/*
switch( d_settings.updateType )
{
case Settings::RepaintCanvas:
{
// the axes in this example doesn't change. So all we need to do
// is to repaint the canvas.
canvas()->replot();
break;
}
default:
{
replot();
}
}
*/
}
示例3: replot
void SagittalZMPPlot::push(SensorValues sensors, bool left) {
if (left)
for (int i = PLOT_SIZE-1; i > 0; --i)
data[i] = data[i-1];
else
for (int i = 0; i < PLOT_SIZE - 1; ++i)
data[i] = data[i+1];
float total_weight = (sensors.sensors[Sensors::LFoot_FSR_FrontLeft]
+ sensors.sensors[Sensors::LFoot_FSR_FrontRight]
+ sensors.sensors[Sensors::LFoot_FSR_RearLeft]
+ sensors.sensors[Sensors::LFoot_FSR_RearRight]
+ sensors.sensors[Sensors::RFoot_FSR_FrontLeft]
+ sensors.sensors[Sensors::RFoot_FSR_FrontRight]
+ sensors.sensors[Sensors::RFoot_FSR_RearLeft]
+ sensors.sensors[Sensors::RFoot_FSR_RearRight]);
if (total_weight != 0)
data[left ? 0 : PLOT_SIZE - 1] =
(50.0f*sensors.sensors[Sensors::LFoot_FSR_FrontLeft]
+ 50.0f*sensors.sensors[Sensors::LFoot_FSR_FrontRight]
- 50.0f*sensors.sensors[Sensors::LFoot_FSR_RearLeft]
- 50.0f*sensors.sensors[Sensors::LFoot_FSR_RearRight]
+ 50.0f*sensors.sensors[Sensors::RFoot_FSR_FrontLeft]
+ 50.0f*sensors.sensors[Sensors::RFoot_FSR_FrontRight]
- 50.0f*sensors.sensors[Sensors::RFoot_FSR_RearLeft]
- 50.0f*sensors.sensors[Sensors::RFoot_FSR_RearRight]) / total_weight;
else
data[left ? 0 : PLOT_SIZE - 1] = 0.0f;
replot();
}
示例4: RAD2DEG
void OdomPlot::push(Odometry vision, Odometry motion, Odometry combined, bool left) {
if (left)
for (int i = PLOT_SIZE-1; i > 0; --i){
motionData[i] = motionData[i-1];
visionData[i] = visionData[i-1];
combinedData[i] = combinedData[i-1];
}
else
for (int i = 0; i < PLOT_SIZE - 1; ++i){
motionData[i] = motionData[i+1];
visionData[i] = visionData[i+1];
combinedData[i] = combinedData[i+1];
}
motionData[left ? 0 : PLOT_SIZE - 1] = RAD2DEG(motion.turn);
visionData[left ? 0 : PLOT_SIZE - 1] = RAD2DEG(vision.turn);
combinedData[left ? 0 : PLOT_SIZE - 1] = RAD2DEG(combined.turn);
//std::cout << RAD2DEG(motion.turn) << "\t" << RAD2DEG(vision.turn) << "\t" << RAD2DEG(combined.turn) << "\n";
for(int i=0; i< (PLOT_SIZE-2); ++i){
motionDiff[i] = motionData[i+1] - motionData[i];
visionDiff[i] = visionData[i+1] - visionData[i];
combinedDiff[i] = combinedData[i+1] - combinedData[i];
}
replot();
}
示例5: applyAxisSettings
void Plot::applySettings( const Settings &settings )
{
applyAxisSettings( QwtAxis::yLeft, settings );
applyAxisSettings( QwtAxis::yRight, settings );
replot();
}
示例6: clearGraphs
void LinesVisualisation::performStepComputation()
{
// do not perform painting if not visible
if(!isVisible())
return;
clearGraphs();
QVector<double> x, y;
// Paint the best
for (int i = 0; i < swarm()->size(); i++) {
const Particle *particle = (*swarm())[i];
x.clear();
y.clear();
y = particle->position;
for (int j = 0; j < swarm()->dimension(); j++) {
x.append(j + 1);
}
addGraph();
graph(i)->setData(x, y);
graph(i)->setPen(VisualisationHelper::rainbowCoding(i, swarm()->size()));
}
xAxis->setRange(0, swarm()->dimension());
if (swarm()->dimension() < 20)
{
xAxis->setAutoTickStep(false);
xAxis->setTickStep(1);
}
rescaleAxes(true);
setInteraction(QCP::iRangeDrag, true);
setInteraction(QCP::iRangeZoom, true);
replot();
}
示例7: detachItems
void SweepInspector::loadSweep(int index) {
//load in new sweep values from data
if (data == NULL) return;
if ( (index < 0) || (index >= data->getNumSweeps())) return;
//remove old data and get new
if (d_curve) d_curve->attach(NULL);
detachItems();
fsweep sweep = data->getSweep(index);
d_curve = new QwtPlotCurve( data->timestampFromIndex(index) ); //Qwt will delete() this when its done with it
d_curve->setRenderHint( QwtPlotItem::RenderAntialiased );
d_curve->setStyle( QwtPlotCurve::Lines );
d_curve->setPen( QColor( Qt::yellow ), 2, Qt::SolidLine );
d_curve->setSamples( sweep );
d_curve->attach(this);
QwtInterval frange = data->limits(FREQ);
//setAxisScale(QwtPlot::xBottom, frange.minValue(), frange.maxValue(), (frange.maxValue() - frange.minValue())/ 5.0);
//setAxisScale(QwtPlot::yLeft, -135, 20, 10.0);
setTitle( QString("RF Sweep @ %1").arg(data->timestampFromIndex(index)) );
//set maximum zoom out
zoomer->setZoomBase(QRectF(QPointF(frange.minValue(), 40), QPointF(frange.maxValue(), -135)));
zoomer->zoomBase();
//find max, min, and average values and drop it on plot as well
double max = sweep.first().y(), min = sweep.first().y(), avg=0;
for(int i=0; i < sweep.size(); i++) {
max = std::max(max, sweep.at(i).y());
min = std::min(min, sweep.at(i).y());
avg += sweep.at(i).y();
} avg /= sweep.size();
//add markers onto the plot
QwtPlotMarker *one = new QwtPlotMarker(), *two = new QwtPlotMarker();
one->attach(this); one->setAxes(QwtPlot::xTop, QwtPlot::yRight);
two->attach(this); two->setAxes(QwtPlot::xTop, QwtPlot::yRight);
QwtText tone = QwtText(QString("Max: %1 dBm\nMin: %2 dBm\nAvg: %3 dBm").arg(max).arg(min).arg(avg));
tone.setFont( QFont( "Helvetica", 10, QFont::Bold ) );
tone.setColor( Qt::green );
tone.setRenderFlags(Qt::AlignTop | Qt::AlignLeft);
one->setLabel(tone);
one->setValue(0, 10);
one->setLabelAlignment(Qt::AlignBottom | Qt::AlignRight);
QwtText ttwo(data->plotText());
ttwo.setFont( QFont( "Helvetica", 10, QFont::Bold ) );
ttwo.setColor( Qt::white );
ttwo.setRenderFlags(Qt::AlignBottom | Qt::AlignRight);
two->setLabel(ttwo);
two->setValue(10, 10);
two->setLabelAlignment(Qt::AlignBottom | Qt::AlignLeft);
replot();
repaint();
}
示例8: QwtPlot
StPlot::StPlot(QWidget* parent):
QwtPlot(parent),
viewFactor(-1.0)
{
setMinimumHeight(10);
setMinimumWidth(10);
QwtPlotGrid *grid = new QwtPlotGrid;
grid->enableXMin(true);
grid->setMajPen(QPen(Qt::white, 0, Qt::DotLine));
grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
grid->attach(this);
setAxisTitle(QwtPlot::xBottom, "Czas [s]");
setAxisTitle(QwtPlot::yLeft, "Amplituda [mv]");
curve = new QwtPlotCurve("Filtered signal");
curve->setYAxis(QwtPlot::yLeft);
curve->attach(this);
ISOPoints = new QwtPlotCurve("ISO");
ISOPoints->setStyle(QwtPlotCurve::NoCurve);
ISOPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::green), QColor(Qt::green), QSize(5, 5)));
ISOPoints->setYAxis(QwtPlot::yLeft);
ISOPoints->attach(this);
JPoints = new QwtPlotCurve("J");
JPoints->setStyle(QwtPlotCurve::NoCurve);
JPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::blue), QColor(Qt::blue), QSize(5, 5)));
JPoints->setYAxis(QwtPlot::yLeft);
JPoints->attach(this);
STPoints = new QwtPlotCurve("ST");
STPoints->setStyle(QwtPlotCurve::NoCurve);
STPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::red), QColor(Qt::red), QSize(5, 5)));
STPoints->setYAxis(QwtPlot::yLeft);
STPoints->attach(this);
RPoints = new QwtPlotCurve("R");
RPoints->setStyle(QwtPlotCurve::NoCurve);
RPoints->setSymbol(new QwtSymbol(QwtSymbol::Ellipse,QColor(Qt::yellow), QColor(Qt::yellow), QSize(5, 5)));
RPoints->setYAxis(QwtPlot::yLeft);
//RPoints->attach(this);
legend = new QwtLegend();
legend->setItemMode(QwtLegend::ReadOnlyItem);
legend->setWhatsThis("Click on an item to show/hide the plot");
this->insertLegend(legend, QwtPlot::RightLegend);
samples = new QVector<QPointF>;
data = new QwtPointSeriesData;
replot();
zoomer = new QwtPlotZoomer(QwtPlot::xBottom, QwtPlot::yLeft, canvas());
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton);
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
zoomer->setMousePattern(QwtEventPattern::MouseSelect4, Qt::NoButton);
zoomer->setMousePattern(QwtEventPattern::MouseSelect5, Qt::NoButton);
zoomer->setMousePattern(QwtEventPattern::MouseSelect6, Qt::NoButton);
}
示例9: setZoomBase
void QcepPlot::updateZoomer()
{
if (m_Zoomer && m_Zoomer -> zoomRectIndex() == 0) {
m_Zoomer -> setZoomBase();
}
replot();
}
示例10: enableAxis
void
RealtimePlot::showSpeed(int state)
{
showSpeedState = state;
spdCurve->setVisible(state == Qt::Checked);
enableAxis(yRight2, state == Qt::Checked);
replot();
}
示例11: replot
void PerformanceManagerWindow::configChanged()
{
if (active) {
days = 0; // force replot
replot();
}
PMpicker->setRubberBandPen(GColor(CPLOTSELECT));
}
示例12: replot
void Plot::setResampleMode( int mode )
{
RasterData *data = static_cast<RasterData *>( d_spectrogram->data() );
data->setResampleMode(
static_cast<QwtMatrixRasterData::ResampleMode>( mode ) );
replot();
}
示例13: replot
void SaxsviewImage::setMajorTicksVisible(bool on) {
for (int i = QwtPlot::yLeft; i < QwtPlot::axisCnt; ++i) {
QwtScaleDraw *draw = p->scales[i]->scaleDraw();
draw->setTickLength(QwtScaleDiv::MajorTick, on ? 8 : 0);
}
replot();
}
示例14: replot
void Oscilloscope::on_new_data(double * d)
{
for (int i = 0; i < channels;i++) {
channel_data[i].erase(channel_data[i].begin());
channel_data[i].push_back(d[i]);
}
replot();
}
示例15: canvasPalette
void caStripPlot::setBackground(QColor c)
{
thisBackColor = c;
QPalette canvasPalette(c);
canvasPalette.setColor(QPalette::Foreground, QColor(133, 190, 232));
canvas()->setPalette(canvasPalette);
replot();
}