Skip to content

Commit

Permalink
close #150; close #151
Browse files Browse the repository at this point in the history
  • Loading branch information
sosiristseng committed Oct 7, 2024
1 parent 76f11c2 commit b36c88b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
title: Plots.jl Tips
date: 2024-03-29
tags:
- julia
- visualization
categories:
- code
---

Some tips about [Plots.jl](https://docs.juliaplots.org/stable/), the de-facto standard visualization library in Julia.
Expand Down Expand Up @@ -107,10 +110,7 @@ str = L"\textrm{Count}"

## Shared Color bar

Source: <https://discourse.julialang.org/t/plots-jl-shared-colorbar-with-subplots/47269/4>

The trick is to

[Source](https://discourse.julialang.org/t/plots-jl-shared-colorbar-with-subplots/47269/4). The trick is to
- make an blank scatter plot for the colorbar.
- use a dedicated space in the layout for the colorbar.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Get 2D indices from a linear index
date: 2024-03-30
tags:
- julia
categories:
- code
---

Use `CartesianIndices((nrow, ncol))`, from this [discourse post](https://discourse.julialang.org/t/julia-usage-how-to-get-2d-indexes-from-1d-index-when-accessing-a-2d-array/61440).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ title: Get the ODE Function from an ODE system
date: 2024-03-31
tags:
- julia
- ode
categories:
- code
---

`f = ODEFunction(sys)` could be useful in plotting vector fields.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ date: 2024-04-01
tags:
- julia
- visualization
categories:
- code
---

In the VSCode plot panel and https://github.com/fredrikekre/Literate.jl notebooks, PNG images are generally smaller than SVG ones. To force plots to be shown as PNG images, you can use https://github.com/tkf/DisplayAs.jl to show objects in a chosen MIME type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Dealing with DomainErrors
date: 2024-04-02
tags:
- julia
categories:
- code
---

`sqrt(x)`, `log(x)`, and `pow(x)` will throw `DomainError` exceptions with negative `x`, interrupting differential equation solvers. One can use these functions' counterparts in https://github.com/JuliaMath/NaNMath.jl, returning `NaN` instead of throwing a `DomainError`. Then, the solvers will reject the solution and retry with a smaller time step.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
title: PyPlotjl tips
title: PyPlot.jl tips
date: 2024-04-04
tags:
- julia
- visualization
- tiff
categories:
- code
---

Some tips about https://github.com/JuliaPy/PyPlot.jl, the `matplotlib` (Python) visualization library for Julia. See also [docs for matplotlib](https://matplotlib.org/) since `PyPlot.jl` largely follows `matplotlib`'s API.
Expand Down
14 changes: 14 additions & 0 deletions docs/blog/posts/2024-10-07-julia-convert-vv-to-matrix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Convert vector of vector to matrix
date: 2024-10-07
tags:
- julia
categories:
- code
---

Use the [stack](https://docs.julialang.org/en/v1/base/arrays/#Base.stack) function.

```julia
stack([[1,0,1],[0,0,1]], dims=1) == [ 1 0 1 ; 0 0 1 ]
```

0 comments on commit b36c88b

Please sign in to comment.