Hi, I am trying to give user choice to pick color patterns for colorScale.
but it is giving me an error but i dont know how to fix it . I know its very easy but i just cant figure it out .would be really happy if you could help me out on this.
bool QCPLayoutGrid::addElement(int, int, QCPLayoutElement*) There is already an element in the specified row/column: 0 1

 ui->customPlot->plotLayout()->addElement(0, 1, colorScale); // add it to the right of the main axis rect
    colorScale->setType(QCPAxis::atRight); // scale shall be vertical bar with tick/axis labels right (actually atRight is already the default)
    //colorScale->rescaleDataRange(true);

    colorMap->setColorScale(colorScale); // associate the color map with the color scale

    // set the color gradient of the color map to one of the presets:


    //colorMap->setGradient(QCPColorGradient::gpPolar);

    QCPColorGradient customGradient;

    // rescale the data dimension (color) such that all data points lie in the span visualized by the color gradient:
    QCPRange colorRange = QCPRange(0,4000);
    colorScale->setDataRange(colorRange);

    if(option1 == true){
        customclr1.clearColorStops();
        customclr1.setColorStopAt(0,QColor(0,0,0));
         customclr1.setColorStopAt(0.2,QColor(200,1,200));
          customclr1.setColorStopAt(0.4,QColor(255,0,255));
           customclr1.setColorStopAt(0.8,QColor(100,255,51));

        customclr1.setColorStopAt(1,QColor(0,255,0));
        customclr1.setColorInterpolation(QCPColorGradient::ColorInterpolation::ciRGB);

    }

    else if(option2 == true){
        customclr1.clearColorStops();
        customclr1.setColorStopAt(0,QColor(255,0,0));
         customclr1.setColorStopAt(0.2,QColor(200,1,200));
          customclr1.setColorStopAt(0.4,QColor(255,0,255));
           customclr1.setColorStopAt(0.8,QColor(255,255,51));

        customclr1.setColorStopAt(1,QColor(0,255,0));
        customclr1.setColorInterpolation(QCPColorGradient::ColorInterpolation::ciRGB);

    }