Hi,
To answer the second point, something like
self.myplot.getAxis("top").setStyle(tickLength=0, showValues=False)
will draw just a plain line as an axis.
I knew you were going to ask the first point... :) Unfortunately there is
just one "pen" parameter to AxisItem
<http://www.pyqtgraph.org/documentation/graphicsItems/axisitem.html#pyqtgraph.AxisItem.setPen>
which controls the color of the axis line, grid lines and labels. So this
probably doesn't do what you want:
self.myplot.getAxis("bottom").setPen({"color": (255, 0, 0), "width": 5})
I can't see an easy way to change this. The easiest would be to do it by
subclassing AxisItem, and just overriding the drawPicture
<http://www.pyqtgraph.org/documentation/_modules/pyqtgraph/graphicsItems/AxisItem.html#AxisItem>
method with different hardcoded pens for axis lines, and grid lines. A
nicer way would be to put the options in the constructor of course... When
you create a PlotItem
<http://www.pyqtgraph.org/documentation/graphicsItems/plotitem.html#pyqtgraph.PlotItem.__init__>
(eg with graphicsLayout.addPlot(...) method, you can pass in instances of
your custom AxisItem(s) you have created for it to use.
Patrick
On Thursday, 23 May 2019 17:19:58 UTC+9:30, JJ wrote:
>
>
> - How can I change the color and width of the axis items and the
> gridlines?
> - How can I show plain lines on the top and right without the labels?
>
> I have tried the following:
> self.myplot.showAxis('right')
> self.myplot.showAxis('top')
>
> However, this shows additional x, y values on the top and right AND messes
> up the zoom behavior in one-mouse mode.
> I just want to show a plain line on the top and right.
>
>
--
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/0aba7b88-a265-47df-98a6-bc8d10d10a81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.