-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Boxplot support #2542
Comments
Hi @noonchen We're not opposed to adding box-plot support, but given that those kinds of plots don't typically undergo rapid updating, we're probably not going to get much interest from maintainers on implementing it (I do not speak for other maintainers besides myself so I could be mistaken here). We do have an example that shows how to do your own boxplot which may be of help if you want to roll out your own thing; the code isn't too bad. Example: https://github.com/pyqtgraph/pyqtgraph/blob/master/pyqtgraph/examples/customGraphicsItem.py Result: If you all do roll out your own thing, and want to contribute it to the library, we would certainly be receptive to that! |
Hi @j9ac9k, Thanks for the example! , I looked into the code and I think I can implement one on my own. If it looks good I'll create a pr. |
Hi @j9ac9k , I am working on the boxplot feature, it is almost finished, but I have encountered some difficulties in drawing The Code can be found here. |
I was able to draw your outlier points in device coordinates by moving the relevant code out of There are some other things to handle, which would be computing the def paint(self, p, *args):
if self.picture is None:
self.generatePicture()
p.drawPicture(0, 0, self.picture)
if not self.opts["outlier"]:
return
# outlier related style
if isinstance(self.opts["symbol"], QtGui.QPainterPath):
symbol = self.opts["symbol"]
else:
symbol = QtGui.QPainterPath()
symbol.addEllipse(QRectF(-0.5, -0.5, 1, 1))
symbolPen = pg.mkPen(self.opts["symbolPen"])
symbolSize = 5 if self.opts["symbolSize"] is None else self.opts["symbolSize"]
symbolBrush = pg.mkBrush(self.opts["symbolBrush"])
p.setPen(symbolPen)
p.setBrush(symbolBrush)
for pos, outliers in self.outlierData.items():
for o in outliers:
x, y = (pos, o)
pt = self.mapToScene(x, y)
tr = QtGui.QTransform.fromTranslate(pt.x(), pt.y()).scale(symbolSize, symbolSize)
p.setTransform(tr)
p.drawPath(symbol) |
@pijyoi Thank you so much! This problem has bothered me for so long, your solution works perfectly. |
Greetings,
I am trying to rewrite
matplotlib
code inpyqtgraph
, but it seems boxplot (matplotlib api) is not presented in the latest release, and surprisingly I cannot find any example in google or StackOverFlow.Is it possible to add it in the roadmap?
Thanks!
The text was updated successfully, but these errors were encountered: