This guide covers the process of changing the background in a ParaView RenderView between solid colors, gradients, and images.
For the purposes of this article, we will be using Paraview 5.4.1.
For help running ParaView scripts, please see the batch-execution instructions.
The background can be changed in the “Background” section of the “View” Settings in the Properties tab.
There are 3 selection options: Single Color, Gradient and Image.
In Single Color mode, you can choose the background color by clicking the color selection.
Which then opens the color picker.
Gradient mode works in the same manner as Single Color mode, but two color selections are required.
Image mode requires the user to select an image from the disk to serve as the background.
Click the second drop-down to select the image from file.
First, ensure that the
paraview.simple module is loaded.
And that an active view exists:
render_view = paraview.simple.GetActiveViewOrCreate('RenderView')
Single Color Background
To adjust a single color background, set its RGB values where each is a value between 0 and 1.
render_view.Background = [0.5, 0.0, 0.0]
To activate Gradient mode, set the
render_view.UseGradientBackground = 1
and then set both background RGB values, as you did in Single Color mode.
render_view.Background = [0.5, 0.0, 0.0] render_view.Background2 = [0.5, 0.0, 0.5]
To turn off Gradient mode, unset the
render_view.UseGradientBackground = 0