# How can I draw a plot with Logarithmic scales in Juliabox?

**URL:** <https://discourse.julialang.org/t/how-can-i-draw-a-plot-with-logarithmic-scales-in-juliabox/23577>\
**Category:** Visualization\
**Created:** [April 26, 2019, 7:46pm UTC](https://discourse.julialang.org/t/how-can-i-draw-a-plot-with-logarithmic-scales-in-juliabox/23577 "2019-04-26T19:46:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PP\_PAN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pp_pan/32/8190_2.png) [@PP\_PAN](https://discourse.julialang.org/u/PP_PAN)\
**Post date:** [April 26, 2019, 7:46pm UTC](https://discourse.julialang.org/t/how-can-i-draw-a-plot-with-logarithmic-scales-in-juliabox/23577/1 "2019-04-26T19:46:21Z")

</div>

![QQ20190426154515](https://global.discourse-cdn.com/julialang/original/3X/5/d/5de86afb80666a06378c738faa85348a00ad6a15.png)

---

<div class="post-metadata">

**Author:** ![yha](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yha/32/3502_2.png) [@yha](https://discourse.julialang.org/u/yha)\
**Post date:** [April 27, 2019, 7:03pm UTC](https://discourse.julialang.org/t/how-can-i-draw-a-plot-with-logarithmic-scales-in-juliabox/23577/2 "2019-04-27T19:03:42Z")

</div>

You are trying to plot the value 0 (the first element in `w_wn`) on a logarithmic scale, which is impossible since it would have to be drawn at negative infinity. You get the same error message from

```julia
plot( [0], [1], xscale=:log10 )

```

Also, you probably don’t need to call `collect` on your range.  
If you want to initialize `beta1` as the same size as `w_wn` in order to fill it in a loop you can use `similar(w_wn)`, or `zeros(size(w_wn)...)`. But you can also initialize `beta1` directly with a broadcasting computation on `w_wn` instead of that loop.
