by astroluv
Last Updated September 26, 2018 23:26 PM

Maybe this question exists already, but I could not find it.

I am making plots in Python. I don't want to set my axes range such that all points are included - there are some really high or really low values, and all I care about in those points is that they exist - that is, they need to be in the plot, but not on their actual value - rather, somewhere on the top of the canvas.

So i found something that helps a bit in achieving what i want to do in this question Link

So basically this thing works:

```
xmax=0.18
plt.(np.minimum(x,xmax),y)
```

But when I tried something like this then it didn't work.

```
xmin=0.8
xmax=0.18
plt.(np.minimum(x, xmin,xmax),y)
```

How can i solve this?

To force the points above a threshold to a maximum level you may use `np.minimum(x,xmax)`

.

To force the points below a threshold to a minimum level you may use `np.maximum(x,xmin)`

.

To do both you may combine the two commands

```
xlimited = np.minimum(np.maximum(x,xmin),xmax)
```

Note that to have the points restricted in the vertical direction you would do this to the `y`

values of course.

- ServerfaultXchanger
- SuperuserXchanger
- UbuntuXchanger
- WebappsXchanger
- WebmastersXchanger
- ProgrammersXchanger
- DbaXchanger
- DrupalXchanger
- WordpressXchanger
- MagentoXchanger
- JoomlaXchanger
- AndroidXchanger
- AppleXchanger
- GameXchanger
- GamingXchanger
- BlenderXchanger
- UxXchanger
- CookingXchanger
- PhotoXchanger
- StatsXchanger
- MathXchanger
- DiyXchanger
- GisXchanger
- TexXchanger
- MetaXchanger
- ElectronicsXchanger
- StackoverflowXchanger
- BitcoinXchanger
- EthereumXcanger