Open xiaohk opened 7 years ago
That's weird. What is your Julia version and could you run Pkg.status()
?
I have some notebooks for a recent project of mine that have SVGs and they seem to work fine: https://github.com/tlnagy/Crispulator.jl/blob/master/meta/growth_scan_diff_amounts_increasing.ipynb
@tlnagy Yeah some SVGS can be displayed correctly, but some can't. My Julia version is 0.5.
julia> Pkg.status()
11 required packages:
- Cairo 0.2.35
- Colors 0.6.9
- Fontconfig 0.1.1
- Gadfly 0.5.2
- IJulia 1.3.3
- ImageMagick 0.1.8
- ImageView 0.2.0
- Images 0.5.14
- MAT 0.3.1
- Optim 0.7.4
- QuartzImageIO 0.1.4
60 additional packages:
- AxisAlgorithms 0.1.5
- BinDeps 0.4.5
- Blosc 0.1.7
- BufferedStreams 0.2.0
- Calculus 0.1.15
- ColorTypes 0.2.12
- ColorVectorSpace 0.1.12
- Compat 0.10.0
- Compose 0.4.4
- Conda 0.4.0
- Contour 0.2.0
- DataArrays 0.3.11
- DataFrames 0.8.5
- DataStructures 0.5.1
- Dates 0.4.4
- DiffBase 0.0.2
- Distances 0.3.2
- Distributions 0.11.1
- FileIO 0.2.1
- FixedPointNumbers 0.2.1
- FixedSizeArrays 0.2.5
- ForwardDiff 0.3.3
- GZip 0.2.20
- Graphics 0.1.3
- HDF5 0.7.2
- Hexagons 0.0.4
- Hiccup 0.1.1
- Homebrew 0.4.2
- IniFile 0.2.5
- Interpolations 0.3.6
- Iterators 0.2.0
- JSON 0.8.0
- Juno 0.2.5
- KernelDensity 0.3.0
- Libz 0.2.1
- LineSearches 0.1.3
- Loess 0.1.0
- MacroTools 0.3.4
- Measures 0.0.3
- Media 0.2.4
- NaNMath 0.2.2
- Nettle 0.2.4
- PDMats 0.5.2
- PositiveFactorizations 0.0.3
- Ratios 0.0.4
- Reexport 0.0.3
- Rmath 0.1.6
- SHA 0.3.0
- SIUnits 0.1.0
- Showoff 0.0.7
- SortingAlgorithms 0.1.0
- StatsBase 0.12.0
- StatsFuns 0.3.1
- TexExtensions 0.0.3
- Tk 0.4.0
- URIParser 0.1.6
- Winston 0.12.1
- WoodburyMatrices 0.2.1
- ZMQ 0.4.0
- Zlib 0.1.12
Do you happen to have examples that display correctly versus those that don't? Or does it seem to be random?
@tlnagy I think it happens kinda randomly. I have the following function, which displays multiple plots in a loop:
# Iterate within different λ
function multiple_λ(λ_candidates)
for my_λ in λ_candidates
cost1, g1! = cost_and_gradient(zeros(28, 1), my_λ)
# Find the parameters
res = optimize(cost1, g1!, repeat([0.5], inner = size(feature, 2)))
mini_Θ = Optim.minimizer(res)
# Plot the decision boundaries
l2 = layer(z = (x1,x2) -> decision(x1, x2, mini_Θ),
x = linspace(-1.0, 1.5, 1000),
y = linspace(-1.0, 1.5, 1000),
Geom.contour(levels = [0.0]),
Theme(line_width = 1pt))
p5 = plot(l1, l2, coord,
Scale.color_discrete_manual(colorant"deep sky blue",
colorant"light pink"),
Guide.title("Regularization with λ = $(my_λ)"))
display(p5)
end
end
If I run multiple_λ([0, 1, 5, 10, 100])
, it should have displayed five plots, but the output displayed on Github looks like:
What if you run multiple_λ([1, 1, 1, 10, 10])
?
@tlnagy It follows the old pattern. I thought the error happens alternately, but in the whole running process 7 plots are displayed correct, fail, fail, correct, fail, correct, fail, correct.
@tlnagy It might be helpful to see the notebook. https://github.com/xiaohk1997/test/blob/master/exercise2.ipynb
That's super weird. All the 1
plots should be identical, no?
@tlnagy Yes, they should all be the same.
No idea what's going on, maybe cross-post this with IJulia.jl? Maybe @stevengj might know?
@tlnagy Ok, thanks! BTW, the plots are displayed as texts when I reopen the notebook locally.
Is this normal?
That isn't normal either haha. I haven't seen that before. Can you open the .ipynb file and copy the code corresponding to that cell? It looks like the SVG code is getting stripped.
@tlnagy All the plots are displayed like that locally. That code is:
# Visualizing the data
p3 = plot(df, x = :test1, y = :test2, color = :result,
Scale.color_discrete_manual(colorant"deep sky blue",
colorant"light pink"))
You can visit the .ipynb file here: https://github.com/xiaohk1997/test/blob/master/exercise2.ipynb
I meant the raw JSON code of the ipynb:
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 1. Logistic Regression\n",
"In this part, we are going to implement the logistic regression to classify admission given two feature.\n",
"## 1.1 Visualize the data\n",
"In this exercise, I want to use the `DataFrame.jl` to implement. We now can import the data as below."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
....
The SVGs look fine there. Not sure what is up.
When I run the Jupyter cell using IJulia, the plot is displayed correctly. However, when I reopen the same notebook, the output of that cell becomes some texts rather than the plots.
I have pushed the Jupyter notebook to Github, and there seems an error displaying my plots as well. The displaying error is not corresponding to the strange text output. When I open the Jupyter locally, all plots have become texts, but there are only some plots can't be displayed in Github.
I tried to re-run all the cells in Jupyter notebook. When I reopen the notebook, all the plots became texts. On Github, the displaying error occurs to the same plots.
I am wondering how to fix it?