# Pcolormesh like replacement using Images.jl?

**URL:** <https://discourse.julialang.org/t/pcolormesh-like-replacement-using-images-jl/5076>\
**Category:** New to Julia\
**Created:** [July 26, 2017, 7:11pm UTC](https://discourse.julialang.org/t/pcolormesh-like-replacement-using-images-jl/5076 "2017-07-26T19:11:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robblackwell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robblackwell/32/2720_2.png) [@robblackwell](https://discourse.julialang.org/u/robblackwell)\
**Post date:** [July 26, 2017, 7:11pm UTC](https://discourse.julialang.org/t/pcolormesh-like-replacement-using-images-jl/5076/1 "2017-07-26T19:11:00Z")

</div>

I’m trying to visualise some 2D data using Images.jl (I’ve previously been using PyPlot and pcolormesh).

```julia
using Images, ImageView
a = [2.0 3.4 100; 34 100 2; 100 34 10]
imshow(a)

```

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

Works well.

But when I try to do the same in an IJulia Jupter notebook, with something like

```julia
colorview(Gray,a)

```

I just get a blank image.

How can I take a 2D array of arbitrary floating point numbers and visualise it consistently in both ImageView and IJulia please?

Also, is there a way to do something similar to pcolormesh and get an RGB image with a supplied color pallete, scaled between some vmin and vmax please?

---

<div class="post-metadata">

**Author:** ![John\_Hearns](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/john_hearns/32/1685_2.png) [@John\_Hearns](https://discourse.julialang.org/u/John_Hearns)\
**Post date:** [July 27, 2017, 12:00pm UTC](https://discourse.julialang.org/t/pcolormesh-like-replacement-using-images-jl/5076/2 "2017-07-27T12:00:31Z")

</div>

> [@robblackwell](#):
>
> a = [2.0 3.4 100; 34 100 2; 100 34 10]

Rob, on Windows with Julia 0.6 this works for me  
Pkg.add("ImageView)  
using ImageView, Images  
img=colorview(Gray,a)  
imshow(img)

---

<div class="post-metadata">

**Author:** ![robblackwell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robblackwell/32/2720_2.png) [@robblackwell](https://discourse.julialang.org/u/robblackwell)\
**Post date:** [November 23, 2017, 2:46pm UTC](https://discourse.julialang.org/t/pcolormesh-like-replacement-using-images-jl/5076/3 "2017-11-23T14:46:43Z")

</div>

Values must be between 0 and 1, so this works:

```julia
using Images

function matrix_to_gray(a::Matrix)
    a = Float64.(a)
    b = minimum(a)
    c = maximum(a)
    d = (a .- b) / (c -b)
    colorview(Gray, d)
end

```
