Changing the background color of the axes planes of a 3D plot

2024/11/18 19:58:10

On the basis of the scatterplot example of matplotlib, how can I change the gray background color of the 3 axes grid planes? I would like to set it to white, keeping the grid lines with the default gray color. I found this question but I couldn't apply it to the example. Thanks.

Answer

Using the same example. You can set the pane color using the set_pane_color method as described here http://matplotlib.org/mpl_toolkits/mplot3d/api.html#axis3d. You can set the color using the RGBA tuple:

# scatter3d_demo.py
# ...
# Set the background color of the pane YZ
ax.w_xaxis.set_pane_color((1.0, 1.0, 1.0, 1.0))
plt.show()
https://en.xdnf.cn/q/26530.html

Related Q&A

Select checkbox using Selenium with Python

How can I select the checkbox using Selenium with Python? from selenium import webdriver from selenium.webdriver.common.keys import Keysbrowser = webdriver.Firefox() url = Any URL browser.get(url)brow…

linear programming in python?

I need to make a linear programming model. Here are the inequalities Im using (for example):6x + 4y <= 24 x + 2y <= 6 -x + y <= 1 y <= 2I need to find the area described by these inequaliti…

Beginner Python Practice? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic…

Pylint: Disable specific warnings for specific folder

We have a Python project laid out like this:project/ ├── .pylintrc ├── module1.py ├── module2.py └── tests/├── test_module1.py└── test_module2.pyOur unit and function tests reside in …

PyCharm: Configuring multi-hop remote Interpreters via SSH

To connect to the computer at my office I need to run ssh twice. First to connect to the host-1 and then from host-1 to host-2 and each one has different credentials. However the configuration menu in …

Return results from multiple models with Django REST Framework

I have three models — articles, authors and tweets. Im ultimately needing to use Django REST Framework to construct a feed that aggregates all the objects using the Article and Tweet models into one r…

Comparing XML in a unit test in Python

I have an object that can build itself from an XML string, and write itself out to an XML string. Id like to write a unit test to test round tripping through XML, but Im having trouble comparing the tw…

Passing a tuple as command line argument

My requirement is to pass a tuple as command line argument like --data (1,2,3,4)I tried to use the argparse module, but if I pass like this it is receiving as the string (1,2,3,4). I tried by giving ty…

Setting exit code in Python when an exception is raised

$ cat e.py raise Exception $ python e.py Traceback (most recent call last):File "e.py", line 1, in <module>raise Exception Exception $ echo $? 1I would like to change this exit code fr…

cmake error the source does not appear to contain CMakeLists.txt

Im installing opencv in ubuntu 16.04. After installing the necessary prerequisites I used the following command:-kvs@Hunter:~/opencv_contrib$ mkdir build kvs@Hunter:~/opencv_contrib$ cd build kvs@Hunte…