# Pressure scale does not rescale correctly

**URL:** https://discourse.paraview.org/t/pressure-scale-does-not-rescale-correctly/8093
**Category:** ParaView Support
**Tags:** python
**Created:** [September 28, 2021, 2:30pm UTC](https://discourse.paraview.org/t/pressure-scale-does-not-rescale-correctly/8093 "2021-09-28T14:30:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![benediktB](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/9f8e36/32.png) [@benediktB](https://discourse.paraview.org/u/benediktB)
#### Post date: [September 28, 2021, 2:30pm UTC](https://discourse.paraview.org/t/pressure-scale-does-not-rescale-correctly/8093/1 "2021-09-28T14:30:15Z")

</div>

Dear community,  
I use pvbatch-scripts to create images of my simulation results. I use the paraview version 5.7.0\_mesa. I have a pressure field, which I want to bound to 1e5 to 1e6 for all images I take. For the pressure display I use the following code:

```auto
def PressureDisplayer( input_data, input_viewer ) :
    # create LUT
    pressureLUT = pv.GetColorTransferFunction('pressure')
    pressureLUT.UseLogScale = 1
    pressureLUT.ScalarRangeInitialized = 1.0
    pv.ImportPresets(filename='../../own_scale.xml')
    pressureLUT.ApplyPreset('blueorange', True)
    pressureLUT.RescaleTransferFunction( 1e5, 1e6 )
    # create display
    x_pressure_displayer = pv.Show( input_data, input_viewer )
    x_pressure_displayer.Representation = 'Surface'
    x_pressure_displayer.ColorArrayName = ['POINTS', 'pressure']
    x_pressure_displayer.LookupTable = pressureLUT
    # show color bar
    pressureLUT_color_bar = pv.GetScalarBar(pressureLUT, input_viewer)
    pressureLUT_color_bar.Title = 'pressure'
    pressureLUT_color_bar.ComponentTitle = ''
    pressureLUT_color_bar.TitleFontSize = 25
    pressureLUT_color_bar.LabelFontSize = 25
    pressureLUT_color_bar.ScalarBarThickness = 15
    pressureLUT_color_bar.ScalarBarLength = 0.25
    pressureLUT_color_bar.TitleColor = [0,0,0]
    pressureLUT_color_bar.LabelColor = [0,0,0]
    pressureLUT_color_bar.Visibility = 1
    x_pressure_displayer.SetScalarBarVisibility(input_viewer, True)
    return x_pressure_displayer

```

For some reason, `RescaleTransferFunction` does not rescale to the correct values for some images. However, if I comment the rescale command out, a completey different range is used, so the command does something, but the wrong thing.  
Is it a error in my code, i.e. are the commands in a wrong order or is it a bug in paraview?  
Thanks for your help!

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [September 28, 2021, 2:46pm UTC](https://discourse.paraview.org/t/pressure-scale-does-not-rescale-correctly/8093/2 "2021-09-28T14:46:45Z")

</div>

Try adding

```python
pressureLUT.AutomaticRescaleRangeMode = 'Never'

```

ParaView has some auto rescaling modes available - the line I provided turns automatic rescaling off.

---

<div class="post-metadata">

### Author: ![benediktB](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/9f8e36/32.png) [@benediktB](https://discourse.paraview.org/u/benediktB)
#### Post date: [October 1, 2021, 10:52am UTC](https://discourse.paraview.org/t/pressure-scale-does-not-rescale-correctly/8093/3 "2021-10-01T10:52:15Z")

</div>

This line solved the problem.  
Thank you very much!
