# How to rescale glyph within pvpython

**URL:** https://discourse.paraview.org/t/how-to-rescale-glyph-within-pvpython/9078
**Category:** ParaView Support
**Tags:** python
**Created:** [February 26, 2022, 4:39pm UTC](https://discourse.paraview.org/t/how-to-rescale-glyph-within-pvpython/9078 "2022-02-26T16:39:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![M8kmyday](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@M8kmyday](https://discourse.paraview.org/u/M8kmyday)
#### Post date: [February 26, 2022, 4:39pm UTC](https://discourse.paraview.org/t/how-to-rescale-glyph-within-pvpython/9078/1 "2022-02-26T16:39:15Z")

</div>

When using pvpython, the glyph plots I generate are being improperly scaled. The plots always come in with a scale factor of 0.00025. To get the correct scale, the rescale button must be manually clicked in the GUI after the script is run. I am using Paraview 5.7.0 under Ubuntu 20.04.2.0 LTS. Here is a stripped-down test snippet that demonstrates the issue:

```
  from paraview.simple import *
  paraview.simple._DisableFirstRenderCameraReset()

  EM2Dpvd = GetActiveSource()
  EM2Dpvd.CellArrays = ['attribute']
  EM2Dpvd.PointArrays = ['Et_im', 'Et_re', 'Ez_im', 'Ez_re', 'Ht_im', 'Ht_re', 'Hz_im', 'Hz_re', 'Pz_re', 'Pz_im']

  EM2DView = GetActiveViewOrCreate('RenderView')
  Hide(EM2Dpvd, EM2DView)

  Et_calculator = Calculator(Input=EM2Dpvd)
  Et_calculatorDisplay = Show(Et_calculator, EM2DView)
  Et_calculator.Function = 'Et_re_X*iHat+Et_re_Y*jHat'

  Et_glyph = Glyph(Input=Et_calculator,GlyphType='2D Glyph')
  RenameSource("Et real vector",Et_glyph)
  Et_glyphDisplay = Show(Et_glyph, EM2DView)
  Et_glyph.OrientationArray = ['POINTS', 'Result']
  Et_glyph.ScaleArray = ['POINTS', 'Result']

  EM2DView.Update()

```

I can certainly scale the plot within the script with

```
  Et_glyph.ScaleFactor = some number

```

but the question is what number to use? I have successfully and separately used Python Calculator and Programmable Filter to calculate the needed scale factor, but I cannot find a way to get the number into the code above to set Et\_glyph.ScaleFactor.

In the end, I’m just looking for a way that the glyphs are plotted from pvpython with the correct scale factor for a nice-looking plot.

---

<div class="post-metadata">

### Author: ![ahmad\_alminnawi](https://discourse.paraview.org/user_avatar/discourse.paraview.org/ahmad_alminnawi/32/10976_2.png) [@ahmad\_alminnawi](https://discourse.paraview.org/u/ahmad_alminnawi)
#### Post date: [March 8, 2023, 4:32pm UTC](https://discourse.paraview.org/t/how-to-rescale-glyph-within-pvpython/9078/2 "2023-03-08T16:32:39Z")

</div>

Hey was this answered or did you figure it out?  
I have the same issue now I want the script to automatically rescale the glyph with respect to the given data (just like pressing the button in paraview) but I can not find what the glyph.ScaleFactor should be.

I would appreciate it if you can let me know

---

<div class="post-metadata">

### Author: ![M8kmyday](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/m/ee7513/32.png) [@M8kmyday](https://discourse.paraview.org/u/M8kmyday)
#### Post date: [March 8, 2023, 11:55pm UTC](https://discourse.paraview.org/t/how-to-rescale-glyph-within-pvpython/9078/3 "2023-03-08T23:55:42Z")

</div>

Hi Ahmad,

The question was not answered, and I did not figure it out. I manually rescale every time.

Brian
