python-3.x - pyqtgraph custom grid [Python/Qt]
问题描述
I am trying to make my plot contain a grid with specific features like the grid lines separations, but I am not sure if pyqtgraph allows it. Anyone knows how to achieve this?
解决方案
The PlotItem class in pyqtgraph contains a showGrid function. For instance:
plot_example = pyqtgraph.plot(x_values, y_values)
plot_example.showGrid(True, True, 0.5)
By default, showGrid(x=None, y=None, alpha=None). first argument specifies whether or not to show x grid, second argument specifies whether or not to show the y grid, and alpha provides a variable opacity for the grid.
More info can be found here: http://www.pyqtgraph.org/documentation/_modules/pyqtgraph/graphicsItems/PlotItem/PlotItem.html#PlotItem.showGrid
推荐阅读
- python - 我可以使用哪种算法来确定导致当前状态的一系列动作?
- arrays - 在 MATLAB 中实现两个数组的减法和除法方程
- c# - 如何有效地将 bool 转换为 int?
- google-cloud-platform - 我们可以使用 Cloud Data Fusion 执行 python 脚本吗
- javascript - JavaScript中的两个数组内连接
- ruby-on-rails - 使用 RSpec double 进行 Rails 测试:ActiveRecord::AssociationTypeMismatch:
- maven - 如何将依赖项从本地 gradle 缓存复制到 Windows 计算机上的本地 maven 存储库?
- python - blender 2.92 python,大纲中选择的元素。我不希望它成为
- reactjs - 如何处理 Shopify GraphQL 批量请求并下载响应?
- unity3d - 很好地弯曲轨道和道具的方法?