Hi Patrick,
Setting the z value of the axes items worked as you suggested. However, the
grid is now rendered on top of the plotted curve. Do you have an idea of
how to render the curve on top?
I have tried setting the z value of the curve but this doesn't seem to help.
self.viewbox.setBackgroundColor((192,192,192))
self.myplot.getAxis("bottom").setPen({"color": (255, 255, 255), "width": 5})
self.myplot.getAxis("left").setPen({"color": (255, 255, 255), "width": 5})
for k in ['bottom', 'left']:
axis = self.myplot.getAxis(k)
axis.setZValue(1)
curve = self.myplot.plot(self.xdata, self.ydata, pen=MYPEN)
curve.setZValue(1e6) #this doesn't help
John
On Thursday, May 23, 2019 at 2:27:18 AM UTC+2, Patrick wrote:
>
> Hi,
>
> Yeah, all that spacing/padding functionality is buried in the Qt
> QGraphicsWidget
> <https://doc.qt.io/qt-5/qgraphicswidget.html#setContentsMargins> and
> QGraphicsGridLayout <https://doc.qt.io/qt-5/qgraphicsgridlayout.html>
> subclasses of GraphicsWidget etc. Examples:
> # ci is the central item (a GraphicsLayout) of a GraphicsLayoutWidget.
> # Set column spacing between first and second plot
> graphicslayoutwidget.ci.layout.setColumnSpacing(0, 100)
> # Set left, top, right, bottom padding around edges of the layout
> graphicslayoutwidget.ci.layout.setContentsMargins(100, 50, 200, 10)
>
> Patrick
>
> On Wednesday, 22 May 2019 23:44:12 UTC+9:30, JJ wrote:
>>
>> Hi Patrick,
>> I've adjusted the z values and it helps. Do you have any idea about how
>> to adjust the padding of the viewbox?
>> John
>>
>> On Wednesday, May 22, 2019 at 9:17:19 AM UTC+2, Patrick wrote:
>>>
>>> Hi,
>>>
>>> Yeah, I'm not sure if the z-orders are set correctly for everything.
>>> You'd think the background should be drawn behind the grid... Try something
>>> like:
>>> [ plotItem.getAxis(ax).setZValue(10) for ax in plotItem.axes ]
>>> I think the grid lines are then over the top of the plot lines, you may
>>> need to play with the "10" if that's a problem. (Note this is the answer to
>>> getting grid lines over the top of an imageItem as well...)
>>>
>>> Patrick
>>>
>>> On Wednesday, 22 May 2019 16:08:13 UTC+9:30, JJ wrote:
>>>>
>>>> Hi Patrick,
>>>> Thanks, this appears to work. However, the grid lines disappear. Do you
>>>> have any idea on how to prevent the setting of the background color from
>>>> drawing over the grid lines?
>>>>
>>>>
>>>> On Wednesday, May 22, 2019 at 8:16:38 AM UTC+2, Patrick wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I think you want the setBackgroundColor method from ViewBox. So get
>>>>> the ViewBox associated with your PlotItem like:
>>>>> plotItem.getViewBox().setBackgroundColor((192, 192, 192))
>>>>>
>>>>> Patrick
>>>>>
>>>>> On Wednesday, 22 May 2019 04:25:44 UTC+9:30, JJ wrote:
>>>>>>
>>>>>> By default the plot background color is black. However, this color
>>>>>> extends into the area of the axis and padding between the plot area and
>>>>>> window edges.
>>>>>> What I would like to do is change the color and padding of the plot
>>>>>> frame area while leaving the plot area itself black or grey. How is this
>>>>>> possible?
>>>>>>
>>>>>> A good example can be seen here:
>>>>>> https://bokeh.pydata.org/en/latest/docs/gallery/ridgeplot.html
>>>>>>
>>>>>>
>>>>>>
>>>>>>
--
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/2064fc3f-392a-44ca-b173-e6678df14b62%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.