# Plotting in VS Code pane

**URL:** <https://discourse.julialang.org/t/plotting-in-vs-code-pane/97483>\
**Category:** New to Julia\
**Tags:** vscode, luxor\
**Created:** [April 14, 2023, 5:02pm UTC](https://discourse.julialang.org/t/plotting-in-vs-code-pane/97483 "2023-04-14T17:02:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JustCurious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/justcurious/32/202801_2.png) [@JustCurious](https://discourse.julialang.org/u/JustCurious)\
**Post date:** [April 14, 2023, 5:02pm UTC](https://discourse.julialang.org/t/plotting-in-vs-code-pane/97483/1 "2023-04-14T17:02:19Z")

</div>

Creating a drawing using dimensions results in expected plotting behavior in the VS code plot pane:

```julia
using Luxor, Dates
dt=now()
d=Drawing(400, 400, "useDimensions_" * Dates.format(dt, dateformat"yyyymmdd\THHMMSS") * ".png")
background("cyan")
origin()
juliacircles()
finish()
preview()

```

However, specifying a matrix when creating the drawing results in plots being directed to my default PNG app, Paint. Furthermore, two instances of Paint are produced

```julia
using Luxor, Images, Dates
A = zeros(ARGB32, 400, 400)
dt=now()
d=Drawing(A, "useMatrix_" * Dates.format(dt, dateformat"yyyymmdd\THHMMSS") * ".png")
background("orange")
origin()
juliacircles()
finish()
preview()

```

[https://global.discourse-cdn.com/julialang/original/3X/5/d/5d3d8480192910724c7acf24b23ec0d6b106fe6e.mp4](https://global.discourse-cdn.com/julialang/original/3X/5/d/5d3d8480192910724c7acf24b23ec0d6b106fe6e.mp4)

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [April 14, 2023, 6:08pm UTC](https://discourse.julialang.org/t/plotting-in-vs-code-pane/97483/2 "2023-04-14T18:08:34Z")

</div>

Yes. Do you need an explanation, or… ?

---

<div class="post-metadata">

**Author:** ![JustCurious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/justcurious/32/202801_2.png) [@JustCurious](https://discourse.julialang.org/u/JustCurious)\
**Post date:** [April 14, 2023, 6:18pm UTC](https://discourse.julialang.org/t/plotting-in-vs-code-pane/97483/3 "2023-04-14T18:18:07Z")

</div>

@cormullion This adventure started with me just trying to get the color of a pixel as in something like ‘getPixel(300,200)’. In any case, I found the matrix example. So, while it would be nice to understand why the matrix example uses the external app to display the PNG file and/or 'Why two?", I would really like to know if there is a simple way to get pixel values, or a way to access the underlying matrix if using the “Drawing(400, 400, …)” call.

---

<div class="post-metadata">

**Author:** ![JustCurious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/justcurious/32/202801_2.png) [@JustCurious](https://discourse.julialang.org/u/JustCurious)\
**Post date:** [April 14, 2023, 8:02pm UTC](https://discourse.julialang.org/t/plotting-in-vs-code-pane/97483/4 "2023-04-14T20:02:10Z")

</div>

@cormullion I tried the second example in the Luxor Playing with Pixels while “paying attention” and noticed that the plot (which does appear in the VS Code plot pane) is generated by adding the matrix variable A at the end. So, I added the ‘A’ at the end of my code and I guess I can live with not understanding what is happening with my original. Thanks for your input.

```julia
using Luxor, Images, Dates
A = zeros(ARGB32, 400, 400)
dt=now()
d=Drawing(A, "useMatrix_" * Dates.format(dt, dateformat"yyyymmdd\THHMMSS") * ".png")
background("orange")
origin()
juliacircles()
finish()
preview()
**A**

```

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [April 14, 2023, 9:37pm UTC](https://discourse.julialang.org/t/plotting-in-vs-code-pane/97483/5 "2023-04-14T21:37:21Z")

</div>

When you create a drawing out of an array, the surface type (`d.surfacetype`) is set to `:image`, so it will be displayed (by `preview()`) in an external application, rather than in the plot pane. But if Images.jl also installed and active, image arrays can be displayed in the plot pane.

One of the things to be aware of - if you mix arrays and drawing canvases - is that the addresses of pixels won’t correspond directly with the coordinates of vector graphics. It’s easy to get confused…

If you create a drawing directly rather than from an array, you won’t have access to the internal ‘drawing array’ later. It’s possible that something could be changed in the source code, but it’s probably out of scope for this “simple drawing package”.😀

---

<div class="post-metadata">

**Author:** ![JustCurious](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/justcurious/32/202801_2.png) [@JustCurious](https://discourse.julialang.org/u/JustCurious)\
**Post date:** [April 14, 2023, 9:56pm UTC](https://discourse.julialang.org/t/plotting-in-vs-code-pane/97483/6 "2023-04-14T21:56:43Z")

</div>

@cormullion Thank you very much for that! That explanation has clarified a number of things. I think things will be going a lot smoother for me now.
