# ControlSystems / Numeric representation of the x-axis for bodeplot

**URL:** <https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562>\
**Category:** Modelling & Simulations\
**Tags:** package\
**Created:** [October 31, 2022, 2:14pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562 "2022-10-31T14:14:12Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![GottDengDirk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gottdengdirk/32/43952_2.png) [@GottDengDirk](https://discourse.julialang.org/u/GottDengDirk)\
**Post date:** [October 31, 2022, 2:14pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/1 "2022-10-31T14:14:12Z")

</div>

Hello,

I want the numbers on the x-axis to be integers wenn i use “bodeplot”. For example 0 0.2 0.4, but not 2_10^-1 4_10^-1.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![GottDengDirk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gottdengdirk/32/43952_2.png) [@GottDengDirk](https://discourse.julialang.org/u/GottDengDirk)\
**Post date:** [October 31, 2022, 2:15pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/2 "2022-10-31T14:15:08Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/e/7/e716217f44f14d77d3397594bd55db67c52fb57c.png)

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [October 31, 2022, 2:23pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/3 "2022-10-31T14:23:31Z")

</div>

Always helpful to include some code and specify the plotting package you are using, but I’m assuming you’re talking about a Plots.jl recipe for differential equations here?

If so, you should be able to pass the normal Plots kwargs to the recipe, e.g. `xformatter = x -> round(Int, x)` would round every x-tick to an integer, while `xticks = 0:10` would directly set the x-ticks to be 0, 1, 2, …, 10.

If I interpret your plot correctly though your x-ticks are actually 0.2 to 0.9, so integers might not make a lot of sense here?

---

<div class="post-metadata">

**Author:** ![GottDengDirk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gottdengdirk/32/43952_2.png) [@GottDengDirk](https://discourse.julialang.org/u/GottDengDirk)\
**Post date:** [October 31, 2022, 3:22pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/5 "2022-10-31T15:22:39Z")

</div>

Sorry, my expression is wrong. I want to change the scale of x to so  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/5/7528e391b13c187231bf960df4dbea401fc1cbfd.png)

in bodeplot, I don’t know how to modify it.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 31, 2022, 4:15pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/6 "2022-10-31T16:15:05Z")

</div>

If you want the scale to be linear rather than logarithmic, you may pass `xscale=:identity`

```julia
bodeplot(h₁, scale=:identity)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/b/dbd2971ff6eea0d4d66683a976eee80ca68afabf.png)

* * *

You can also pass your own desired tick formatting using the `xticks` argument.

```julia
bodeplot(h₁, xticks=([1, 10, 100], ["a", "b", "c"]))

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/3/f3efe93d80dde0bc5a0e4701b96e7a9d1670f10d.png)

---

<div class="post-metadata">

**Author:** ![runjaj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/runjaj/32/23628_2.png) [@runjaj](https://discourse.julialang.org/u/runjaj)\
**Post date:** [October 31, 2022, 4:39pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/7 "2022-10-31T16:39:06Z")

</div>

I think that the way to remove the scientific notation is ` xformatter=x->round(x;digits=2)`:

```julia
bodeplot(tf(1, [1, 1]), xformatter=x->round(x;digits=2))

```

 ![xformatter.png](https://global.discourse-cdn.com/julialang/original/3X/5/c/5c248733f2b33b1560c3da57440f1fd2e0f79a51.png)

---

<div class="post-metadata">

**Author:** ![GottDengDirk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gottdengdirk/32/43952_2.png) [@GottDengDirk](https://discourse.julialang.org/u/GottDengDirk)\
**Post date:** [October 31, 2022, 6:45pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/9 "2022-10-31T18:45:10Z")

</div>

thanks your reply. And i want to also ask, how to fill the frame around the plot?  
As you can see this is only half the frame.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 31, 2022, 6:49pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/10 "2022-10-31T18:49:32Z")

</div>

> [@GottDengDirk](#):
>
> As you can see this is only half the frame.

Which figure are you referring to? You can make use of the `margin` keyword to alter the margin, i.e.

```julia
plot(..., margin = 5Plots.mm)

```

---

<div class="post-metadata">

**Author:** ![GottDengDirk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gottdengdirk/32/43952_2.png) [@GottDengDirk](https://discourse.julialang.org/u/GottDengDirk)\
**Post date:** [October 31, 2022, 7:06pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/11 "2022-10-31T19:06:23Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/f/5/f57cc4fb97d5e7e1f85202cbca32847504b2fb61.png)

I mean there is only half of the frame in this plot picture.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 31, 2022, 7:08pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/12 "2022-10-31T19:08:03Z")

</div>

ah, I think the keyword is

```julia
framestyle = :box

```

or something like that, I’m not sure exactly which word is used, it might be `:boxed` etc.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [October 31, 2022, 7:09pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/13 "2022-10-31T19:09:11Z")

</div>

In general, all these questions are answered by the documentation of Plots.jl  
[https://docs.juliaplots.org/stable/](https://docs.juliaplots.org/stable/)

---

<div class="post-metadata">

**Author:** ![GottDengDirk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gottdengdirk/32/43952_2.png) [@GottDengDirk](https://discourse.julialang.org/u/GottDengDirk)\
**Post date:** [November 3, 2022, 8:24pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/14 "2022-11-03T20:24:50Z")

</div>

Hello, I would like to modify the range of the Frequency-Phase in the Plot to increase from -300°. But I can only modify the range of the Magnitude. Is there any way to do it?

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [November 3, 2022, 8:54pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/15 "2022-11-03T20:54:32Z")

</div>

It’s a bit tricky, but I think you have to provide limits for the second plot series like this

```julia
plot(..., ylims=[(magmin, magmax) (phasemin, phasemax)]) 

```

---

<div class="post-metadata">

**Author:** ![GottDengDirk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gottdengdirk/32/43952_2.png) [@GottDengDirk](https://discourse.julialang.org/u/GottDengDirk)\
**Post date:** [November 3, 2022, 9:51pm UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/16 "2022-11-03T21:51:26Z")

</div>

I use the bodeplot function, but there is no “ylims=[(magmin, magmax) (phasemin, phasemax)]” method.  
But I found ylimsphase. The result is shown in the figure

 ![image](https://global.discourse-cdn.com/julialang/original/3X/5/9/59e43a8efaeac133c8a012653a1a5a7670c89c81.png)  
Although the range was successfully adjusted, the numbers displayed were unsatisfactory.  
In addition, the curve is not smooth, how to set the plot points?

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [November 4, 2022, 8:24am UTC](https://discourse.julialang.org/t/controlsystems-numeric-representation-of-the-x-axis-for-bodeplot/89562/17 "2022-11-04T08:24:00Z")

</div>

> [@GottDengDirk](#):
>
> But I found ylimsphase.

This is not documented and also not used. You have to use the syntax I suggested above, it’s standard Plots.jl syntax for setting `ylims` for more than one series, similar to how you set different colors for magnitude and phase.

> [@GottDengDirk](#):
>
> the curve is not smooth, how to set the plot points?

Provide the frequency grid to evaluate the Bode curve at.
