Similar post: 
https://groups.google.com/d/topic/pyqtgraph/eb3JUdnWTZQ/discussion

However, changing the library modules is not an option for everyone. Is 
there any other way?

On Wednesday, May 2, 2018 at 10:39:15 AM UTC+5:30, Ankit Kakkar wrote:
>
> Hi,
>
> I am working with PlotWidgets for my project. I need to be able to copy 
> and paste charts. For this I make use of the export functionality. I was 
> able to copy-paste charts previously but now it shows the following error 
> (when I click on copy):
>
> Traceback (most recent call last):
>
>
>   File 
> "C:\ProgramData\Anaconda2\lib\site-packages\pyqtgraph\GraphicsScene\exportDialog.py"
> , line 136, in copyClicked
>     self.currentExporter.export(copy=True)
>
>
>   File 
> "C:\ProgramData\Anaconda2\lib\site-packages\pyqtgraph\exporters\ImageExporter.py"
> , line 70, in export
>     bg = np.empty((self.params['width'], self.params['height'], 4), dtype=
> np.ubyte)
>
>
> TypeError: 'float' object cannot be interpreted as an index
>
>
>
> Not sure why this error is coming even if the width and height params are 
> int.
>
> Does anyone know what is the reason for it? Shared the Sample code below:
>
>             
> w2 = pg.PlotWidget()
> w2.addLegend()
> axis2 = daxis.DateAxisItem(orientation = 'bottom')
> axis2.attachToPlotItem(w2.getPlotItem())
> idx2 = abc.index[lookback2+1:]
> df2 = pd.DataFrame.from_dict(idx2)
> timestamps2 = list(pd.to_timedelta(df2[0]).dt.total_seconds().astype(int))
> w2.plot(x = timestamps2, y = list(100*abc.iloc[lookback2+1:]), name = 
> "ABC", pen = 'b')
> w2.plot(x = timestamps2, y = list(100*def.iloc[lookback2+1:]), name = 
> "DEF", pen = 'r')
> w2.plot(x = timestamps2, y = list(ijk.iloc[lookback2+1:,0]), pen = 'r')
> w2.setLabel('left', 'ABC', units='%')
> w2.setLabel('right', 'DEF', units='%')
> self.ui.verticalLayout2.addWidget(w2)
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/d4db528f-e3fc-4e68-aab0-398bd18d64a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to