# Get a picture icon when I try to plot a histogram

**URL:** <https://discourse.julialang.org/t/get-a-picture-icon-when-i-try-to-plot-a-histogram/79616>\
**Category:** General Usage\
**Tags:** jupyter, plotting\
**Created:** [April 18, 2022, 1:55am UTC](https://discourse.julialang.org/t/get-a-picture-icon-when-i-try-to-plot-a-histogram/79616 "2022-04-18T01:55:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bproferes](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@bproferes](https://discourse.julialang.org/u/bproferes)\
**Post date:** [April 18, 2022, 1:55am UTC](https://discourse.julialang.org/t/get-a-picture-icon-when-i-try-to-plot-a-histogram/79616/1 "2022-04-18T01:55:56Z")

</div>

Hi, I’m trying to make a histogram but whenever I run the command in a jupyter notebook I get a picture icon. I’m using a mac laptop and maybe it is a general issue with the laptop I need to fix.

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [April 18, 2022, 9:54am UTC](https://discourse.julialang.org/t/get-a-picture-icon-when-i-try-to-plot-a-histogram/79616/2 "2022-04-18T09:54:07Z")

</div>

I don’t use Jupyter, so somebody else might turn up and answer, but they will probably have an easier time doing so if you provide a Minimal Working Example: exactly what code do you run, what do you expect it to do, and how does the actual result differ from the expectation?

More information on how to ask an easily answerable question: [Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757)

---

<div class="post-metadata">

**Author:** ![bproferes](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@bproferes](https://discourse.julialang.org/u/bproferes)\
**Post date:** [April 18, 2022, 5:33pm UTC](https://discourse.julialang.org/t/get-a-picture-icon-when-i-try-to-plot-a-histogram/79616/3 "2022-04-18T17:33:33Z")

</div>

Here is the picture of my code

 ![image](https://global.discourse-cdn.com/julialang/original/3X/c/4/c4ffc40e80bf1066bb5dc01b4fb2dea7422a2e94.png)  
I’m expecting a typical histogram

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [April 18, 2022, 5:42pm UTC](https://discourse.julialang.org/t/get-a-picture-icon-when-i-try-to-plot-a-histogram/79616/4 "2022-04-18T17:42:27Z")

</div>

Please read the post I linked to, especially as it pertains to

- Pasting code vs screenshots
- The W in MWE

If I run your code I get `ERROR: Undefined variable "histogram"`. (Or possibly `"samples"`, both of those are undefined, and I don’t off the top of my head know which triggers the error first here)

---

<div class="post-metadata">

**Author:** ![bproferes](https://avatars.discourse-cdn.com/v4/letter/b/87869e/32.png) [@bproferes](https://discourse.julialang.org/u/bproferes)\
**Post date:** [April 19, 2022, 1:58am UTC](https://discourse.julialang.org/t/get-a-picture-icon-when-i-try-to-plot-a-histogram/79616/5 "2022-04-19T01:58:59Z")

</div>

''using Random  
using Plots  
using QuadGK  
using Roots  
using BenchmarkTools

# for readability, these are good settings to use

default(xtickfontsize=14, ytickfontsize=14,  
guidefontsize=14, legendfontsize=12, lw=2,ms=8)

# Initialize value of n

n = 10

# Devise function that calculates random uniform, then takes lowest near integer using floor function

function inv\_sample\_unif()  
a = rand();  
X = floor(a\*(n+1));  
return X  
end

# Set number of samples

num = 10^4;

Random.seed!(100);  
samples = [inv\_sample\_unif() for \_ in 1:num];

histogram(samples, label = “Samples”, norm = :pdf,legend=:topleft)‘’

Here is my code. I think the issue may be with my computer settings if anything. Very new to this so apologies of this is insufficient.
