[pyqtgraph] Re: linearregionitems in log plots are returning unexpected values

2018-03-09 Thread Guillaume William Bres
I face the same problem all the time because I also work with 
logarithmically spaced frequency axis

but we can easily work around it by testing whether log(x) is being used or 
not:

log_state = my_plot.plotItem.ctrl.logXCheck.isChecked()

[x,y] = my_curve.getData() 

if (log_state):
  x = 10**x

   
 

-- 
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 pyqtgraph+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/6801a709-1c16-4736-92bf-0f408229d6dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[pyqtgraph] Re: log(x) axis with negative powers of ten

2018-03-07 Thread Guillaume William Bres
so it turned out the log(x) display was somehow corrupted by my 
xRange(xMin,xMax) values.

My x values range from 0 to 1e7. My actual data ranges from 1e-3 to 1e7. I 
previously set xRange(1e-9 to 1e7) to avoid log(0) @xMin.

In this setup I am no longer getting nicely logarithmically spaced vertical 
lines, 1e^n whhere n<0 are not displayed. But I then modified xRange to 
(-100,1e7) and now I am getting proper vertical lines.

So xRange(-100,1e7) is a solution to get proper vertical lines, but the 
overall UI is no longer super nice because my values never reach x<0, and 
the user can actually scroll down to -100(whatever xMin value I set)

don't know what's happening with axisItems or the related class

-- 
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 pyqtgraph+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/cf40d399-37da-46dc-af85-9080a9fbf229%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[pyqtgraph] log(x) axis with negative powers of ten

2018-02-27 Thread Guillaume William Bres
Hi,

I'm building an application where I need to monitor frequency domain data 
and we use the log(x) feature all the time.

My x (frequency) axis ranges from 1e6 (MHz) down to 1e-3 (mHz) and it seems 
like pyqtgraph is not capable of dealing with 1e^n as long as N<0, by "not 
dealing", I mean I am no longer getting proper ticks, lines are not 
displayed and displaying is messed up (dHz & mHz are not even displayed).

Is there a way I can work around this by creating a custom axis item?

I always build PyQtGraph from the "master" branch which is fairly outdated, 
should I switch to "develop"?

-- 
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 pyqtgraph+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/68de1057-e292-408a-a47d-919208157db6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[pyqtgraph] Override 'writeCsv' of PlotItem class

2017-12-06 Thread Guillaume William Bres
Hello, 

I think what I am trying to do should be doable,

I would like to override the export to csv feature of a PlotWidget that I 
usally build this way:

self.main_plot = pg.PlotWidget(name="main_plot")

self.main_plot.seLogMode..
self.main_plot.showGrid.. 


because I would like the new function to only write the content of curves 
objects (plotDataItems) that do not have a specific name,

here's how I usually build my curves objects:

self.curve = self.main_plot.plot(pen=color)


 So I looked into the library code, and if I got it right, I need to create 
a custom PlotItem class with proper inheritance, because I do not want to 
break any functionality, so far I wrote something like this:

class CustomPlotItem(pg.PlotItem):

# use very same arguments

def __init__(self, parent=None, name=None, labels=None, title=None, 
viewBox=None, axisItems=None, enableMenu=True, **kargs):


# pass all arguments to super so I do not break anything

super(customPlotItem, self).__init__(parent=parent, name=name, )


# use very same name to override

def writeCsv(self, fileName=None):

 

# >> previous code

if fileName is None:

self.fileDialog = FileDialog()

if PlotItem.lastFileDir is not None:

self.fileDialog.setDirectory(PlotItem.lastFileDir)

self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)

self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)

self.fileDialog.show()

self.fileDialog.fileSelected.connect(self.writeCsv)

return

 

# new functionality

fileName = str(fileName)

PlotItem.lastFileDir = os.path.dirname(fileName)

fd = open(fileName, 'w')

data = [c.getData() for c in self.curves]


  data = []

  for c in self.curves:
   if (c.name() != "name_to_drop_out"):
 data.append(c.getData()) 

 

 # previous code 

i = 0

while True:

done = True

for d in data:

if i < len(d[0]):

fd.write('%g,%g,'%(d[0][i], d[1][i]))

done = False

else:

fd.write(' , ,')

fd.write('\n')

if done:

break

i += 1

fd.close()


so my problem is, I am using a pg.PlotWidget in my code, how can I make 
this pg.PlotWidget not to build a usual pg.PlotItem but a custom one?

I tried something dirty so far:

self.main_plot = pg.PlotWidget(name="test")

  customClass = CustomPlotItem() # could use some args? 
  self.main_plot.plotItem = customClass # kill default pointer, 
point to custom stuff
  self.curve = self.main_plot.plot() # try to use it

I guess you guys get the idea,


   - Is this the right approach, do I got the class tree right?
   - since the functionality I want to override is located in plotItem, How 
   do I get my plotWidget class (which is eventually what I use) to actually 
   use it?
   - note: I might be wrong & the functionality writeCsv might be located 
   somewhere else

>> Just want to acknowledge how cool and impressive PyQtGraph is, I have 
been using it for years now, and it's just flawless. Keep up the good work 
guys

thank you

-- 
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 pyqtgraph+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/72499450-ca05-48ce-8fa6-90b4957e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.