# Need to make a custom plot

**URL:** <https://discourse.julialang.org/t/need-to-make-a-custom-plot/17802>\
**Category:** General Usage\
**Created:** [November 21, 2018, 6:38am UTC](https://discourse.julialang.org/t/need-to-make-a-custom-plot/17802 "2018-11-21T06:38:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [November 21, 2018, 6:38am UTC](https://discourse.julialang.org/t/need-to-make-a-custom-plot/17802/1 "2018-11-21T06:38:15Z")

</div>

I need to make a custom plot type (for a smith chart) and i’m wondering what would be the best approach for this.

i’m most familiar with pyplot, i.e. matplotlib ,but not at all with familiar with creating custom plot types. there is already a python package which uses matplotlib to generate smith charts but it is a fairly substantial amount of python code and it’s not at all obvious how i might port it to julia.

I was also looking at GR but can’t seem to find any documentation on how to create your own graph type.

I was looking for some suggestions.

Thank you !

---

<div class="post-metadata">

**Author:** ![y4lu](https://avatars.discourse-cdn.com/v4/letter/y/47e85d/32.png) [@y4lu](https://discourse.julialang.org/u/y4lu)\
**Post date:** [November 21, 2018, 7:29am UTC](https://discourse.julialang.org/t/need-to-make-a-custom-plot/17802/2 "2018-11-21T07:29:26Z")

</div>

[https://github.com/ma-laforge/InspectDR.jl](https://github.com/ma-laforge/InspectDR.jl)

---

<div class="post-metadata">

**Author:** ![jbrea](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jbrea/32/3879_2.png) [@jbrea](https://discourse.julialang.org/u/jbrea)\
**Post date:** [November 21, 2018, 7:58am UTC](https://discourse.julialang.org/t/need-to-make-a-custom-plot/17802/3 "2018-11-21T07:58:18Z")

</div>

[PGFPlotsX](https://github.com/KristofferC/PGFPlotsX.jl) also allows to create nice smith charts.

```julia
julia> using PGFPlotsX

julia> push!(PGFPlotsX.CUSTOM_PREAMBLE, "\\usepgfplotslibrary[smithchart]")
1-element Array{String,1}:
 "\\usepgfplotslibrary[smithchart]"

julia> data = [(0.5,0.2), (1,0.8), (2,2)]
3-element Array{Tuple{Real,Real},1}:
 (0.5, 0.2)
 (1, 0.8)  
 (2, 2)    

julia> TikzPicture("\\begin{smithchart}[title = Impedance Smith Chart,] \\addplot coordinates { $(join(string.(data), " ")) }; \\end{smithchart}")

```

 ![juliaQBpZLe-page1](https://global.discourse-cdn.com/julialang/original/3X/e/d/ed6e2bbeadde50850e951f8c79870d9f6bc97392.png)  
(pixelation due to pdf2png)

---

<div class="post-metadata">

**Author:** ![tkf](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkf/32/17635_2.png) [@tkf](https://discourse.julialang.org/u/tkf)\
**Post date:** [November 21, 2018, 8:18am UTC](https://discourse.julialang.org/t/need-to-make-a-custom-plot/17802/4 "2018-11-21T08:18:17Z")

</div>

If you know a Python package and how to use it already, how about just calling it via PyCall?

---

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [November 21, 2018, 5:51pm UTC](https://discourse.julialang.org/t/need-to-make-a-custom-plot/17802/5 "2018-11-21T17:51:09Z")

</div>

My initial reaction was to try and use the pyplot version but i am completely unfamiliar with PyCall, so I wanted to see what other options were available. also it’s a bit kludgy. I wanted this for a julia package I’m working on and I really didn’t want to have to deal with pulling in the python-only code for another project to make it work. much cleaner if i could use a plot package already in julia.

- I forgot about PGFPlotsX.

- I didn’t even know about InspectDR. That looks _very_ promising for some other work i’m doing that involves data analysis of measurement data in addition to the smith chart capability

- furthermore I think that I understand how the “primitive” layer of GR works, so if I really had to (which I don’t believe i do at this point) I could roll my own in GR.

- finally, if none of the above work I can go read up on pycall and try that.

Lots of good options !

Thank you very much for all the suggestions.
