# Latest

**URL:** https://discourse.julialang.org/latest.md?page=1144

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 1145

---

## [Converting String to Symbol during struct construction](https://discourse.julialang.org/t/converting-string-to-symbol-during-struct-construction/75031)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 15\
**Last updated:** [January 23, 2022, 1:22pm UTC](https://discourse.julialang.org/t/converting-string-to-symbol-during-struct-construction/75031 "2022-01-23T13:22:53Z")

</div>

I am looking at the following Base.@kwdef mutable struct MyStruct id::Int value::Symbol = :fixed end MyStruct(value::String, kwargs...) = MyStruct(value=Symbol(value), kwargs...) MyStruct(id=1, value=:a) …

---

## [How to render ggplot2 plots in html through Weave and RCall?](https://discourse.julialang.org/t/how-to-render-ggplot2-plots-in-html-through-weave-and-rcall/74913)

<div class="topic-metadata">

**Author:** [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Replies:** 2\
**Last updated:** [January 23, 2022, 1:14pm UTC](https://discourse.julialang.org/t/how-to-render-ggplot2-plots-in-html-through-weave-and-rcall/74913 "2022-01-23T13:14:45Z")

</div>

How do I include plots made with ggplot2 (through RCall) in html reports through Weave? I try this (which works in a Jupyter notebook): using RCall, DataFrames d = DataFrame(x = \[1,2,3\], y = \[4,5,6\]) @rput d @rlibrary …

---

## [Confused by Color Terms](https://discourse.julialang.org/t/confused-by-color-terms/75063)

<div class="topic-metadata">

**Author:** [@aachener](https://discourse.julialang.org/u/aachener)\
**Replies:** 1\
**Last updated:** [January 23, 2022, 1:03pm UTC](https://discourse.julialang.org/t/confused-by-color-terms/75063 "2022-01-23T13:03:56Z")

</div>

Hi, guys, I am reading Makie documentations but find myself confused with color terms, like Colormap, ColorScheme, palette… Especially what the difference between colormap and colorscheme? And, how to define my own col…

---

## [Best way to store a sparse, unbalanced, and not complete binary tree](https://discourse.julialang.org/t/best-way-to-store-a-sparse-unbalanced-and-not-complete-binary-tree/74902)

<div class="topic-metadata">

**Author:** [@AlessioLapolla](https://discourse.julialang.org/u/AlessioLapolla)\
**Replies:** 18\
**Last updated:** [January 23, 2022, 12:09pm UTC](https://discourse.julialang.org/t/best-way-to-store-a-sparse-unbalanced-and-not-complete-binary-tree/74902 "2022-01-23T12:09:43Z")

</div>

I am implementing a binary tree where given the key of the root and a function the left and right children are defined up to a given depth that is an other parameter of the constructing function: create\_tree!(tree, key, …

---

## [\[ANN\] LabVIEW0 - Calling Julia from LabVIEW using ZeroMQ](https://discourse.julialang.org/t/ann-labview0-calling-julia-from-labview-using-zeromq/75033)

<div class="topic-metadata">

**Author:** [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Replies:** 2\
**Last updated:** [January 23, 2022, 11:32am UTC](https://discourse.julialang.org/t/ann-labview0-calling-julia-from-labview-using-zeromq/75033 "2022-01-23T11:32:02Z")

</div>

I’m happy to announce this package. The package is alreary registered. For documentation see on GitHub https://github.com/Eben60/LabVIEW0.jl/blob/main/README.md and links therein (I still have to learn Documenter). A num…

---

## [How to optimize this code?](https://discourse.julialang.org/t/how-to-optimize-this-code/74978)

<div class="topic-metadata">

**Author:** [@HANHAOHAN](https://discourse.julialang.org/u/HANHAOHAN)\
**Replies:** 5\
**Last updated:** [January 23, 2022, 10:49am UTC](https://discourse.julialang.org/t/how-to-optimize-this-code/74978 "2022-01-23T10:49:23Z")

</div>

\# REPL using VideoIO using Images using LSHFunctions frms = Vector{UInt64}(undef, 25000); hashfn = LSHFunction(cossim, 64); function one\_pixes(x::Matrix{RGB{Float32}})::Bool pix = x\[1,1\] for…

---

## [Real runtime vs. @btime output](https://discourse.julialang.org/t/real-runtime-vs-btime-output/75001)

<div class="topic-metadata">

**Author:** [@jafar.isbarov](https://discourse.julialang.org/u/jafar.isbarov)\
**Replies:** 11\
**Last updated:** [January 23, 2022, 10:14am UTC](https://discourse.julialang.org/t/real-runtime-vs-btime-output/75001 "2022-01-23T10:14:34Z")

</div>

I am going through this ML tutorial on Julia, and I noticed something odd. Output of the following script using BenchmarkTools using Flux @btime f(x) = x^2+1 @btime df(x) = gradient(f,x,nest=true)\[1\] is this: 0.90…

---

## [Trouble reading numerical data out of a MAT file](https://discourse.julialang.org/t/trouble-reading-numerical-data-out-of-a-mat-file/75052)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 2\
**Last updated:** [January 23, 2022, 2:39am UTC](https://discourse.julialang.org/t/trouble-reading-numerical-data-out-of-a-mat-file/75052 "2022-01-23T02:39:22Z")

</div>

I have a mat file that was created using Julia. It contains a variable T that stores a 360x180 matrix of numerical values that was generated using DIVAnd.jl. I can read the values out using Matlab without any hiccup at a…

---

## [KeyError: key coeffs not found](https://discourse.julialang.org/t/keyerror-key-coeffs-not-found/75017)

<div class="topic-metadata">

**Author:** [@sherlock\_holmes](https://discourse.julialang.org/u/sherlock_holmes)\
**Replies:** 6\
**Last updated:** [January 23, 2022, 1:11am UTC](https://discourse.julialang.org/t/keyerror-key-coeffs-not-found/75017 "2022-01-23T01:11:49Z")

</div>

Hello, I’m getting the error given below continuosly. I know that there is a built-in function named “coeffs” in Julia and I want to use it. I’m trying to implement Zippel’s Algorithm. I also asked it on stackoverflow bu…

---

## [Different gradient behaviour depending on ODE-Definition](https://discourse.julialang.org/t/different-gradient-behaviour-depending-on-ode-definition/74818)

<div class="topic-metadata">

**Author:** [@erico](https://discourse.julialang.org/u/erico)\
**Replies:** 11\
**Last updated:** [January 23, 2022, 12:37am UTC](https://discourse.julialang.org/t/different-gradient-behaviour-depending-on-ode-definition/74818 "2022-01-23T00:37:28Z")

</div>

Hi everyone, I have started using Julia for the identification of ODE-parameters using DiffEqFlux. I noticed some strange behaviour of the “gradient” function that I cannot explain. The following code (which of course m…

---

## [Access cursor position in ImageView.jl](https://discourse.julialang.org/t/access-cursor-position-in-imageview-jl/75032)

<div class="topic-metadata">

**Author:** [@PeteS](https://discourse.julialang.org/u/PeteS)\
**Replies:** 0\
**Last updated:** [January 22, 2022, 1:48pm UTC](https://discourse.julialang.org/t/access-cursor-position-in-imageview-jl/75032 "2022-01-22T13:48:53Z")

</div>

Is it possible to access (and override) the cursor event in ImageView? I’m displaying an indexed image of a microstructure, and at any given (x, y) position I would like to display my data rather than the pixel colour.

---

## [Query.jl, referencing \`\_.key\` in \`@groupby |\> @map\`](https://discourse.julialang.org/t/query-jl-referencing-key-in-groupby-map/17318)

<div class="topic-metadata">

**Author:** [@leethargo](https://discourse.julialang.org/u/leethargo)\
**Replies:** 7\
**Last updated:** [January 22, 2022, 11:19pm UTC](https://discourse.julialang.org/t/query-jl-referencing-key-in-groupby-map/17318 "2022-01-22T23:19:14Z")

</div>

I followed the recording of the Queryverse tutorial at JuliaCon by @davidanthoff and now get errors when I use similar queries. In particular, I want to use the \_.key shortcut in this query (see full example): data |\> …

---

## [MacOS ARM64 no faster than emulated x86?](https://discourse.julialang.org/t/macos-arm64-no-faster-than-emulated-x86/72481)

<div class="topic-metadata">

**Author:** [@dodoplus](https://discourse.julialang.org/u/dodoplus)\
**Replies:** 17\
**Last updated:** [January 22, 2022, 8:37pm UTC](https://discourse.julialang.org/t/macos-arm64-no-faster-than-emulated-x86/72481 "2022-01-22T20:37:45Z")

</div>

I was curious to test the performance of the newly released Julia 1.7 running natively on my M1 laptop. Surprisingly, there doesn’t seem to be any speedup: julia\> include("b.jl") sortperf (generic function with 1 metho…

---

## [Limitation of mixed Tuple types in Arrow.write()?](https://discourse.julialang.org/t/limitation-of-mixed-tuple-types-in-arrow-write/75035)

<div class="topic-metadata">

**Author:** [@SortofDamocles](https://discourse.julialang.org/u/SortofDamocles)\
**Replies:** 2\
**Last updated:** [January 22, 2022, 8:23pm UTC](https://discourse.julialang.org/t/limitation-of-mixed-tuple-types-in-arrow-write/75035 "2022-01-22T20:23:45Z")

</div>

When I run the following: using Arrow, DataFrames x = ((1,), (1,), (), ()); y = ((1, 2), (), (), ()); df = DataFrame(col = \[x, y\]); Arrow.write("test.arrow", df) I get the following error: LoadError: ArgumentError: t…

---

## [\[ANN\] CircStats.jl, Julia version of MATLAB CircStat toolbox](https://discourse.julialang.org/t/ann-circstats-jl-julia-version-of-matlab-circstat-toolbox/74998)

<div class="topic-metadata">

**Author:** [@babaq](https://discourse.julialang.org/u/babaq)\
**Replies:** 8\
**Last updated:** [January 22, 2022, 8:16pm UTC](https://discourse.julialang.org/t/ann-circstats-jl-julia-version-of-matlab-circstat-toolbox/74998 "2022-01-22T20:16:27Z")

</div>

Hi, The circular statistics are important for many areas, and for neuroscience, the MATLAB CircStat toolbox is probably the most well-known and used one. Since i needed it for my own research, I’ve been gradually rewrit…

---

## [Asymmetric error bars and box plots in Julia](https://discourse.julialang.org/t/asymmetric-error-bars-and-box-plots-in-julia/73647)

<div class="topic-metadata">

**Author:** [@newtothis](https://discourse.julialang.org/u/newtothis)\
**Replies:** 3\
**Last updated:** [January 22, 2022, 6:56pm UTC](https://discourse.julialang.org/t/asymmetric-error-bars-and-box-plots-in-julia/73647 "2022-01-22T18:56:41Z")

</div>

I have a Julia program that gives me data in the following form. For each point on X, I get a vector for the Y axis. I want to plot a boxplot for each X value using the vector of Y values. So I want the median to be the …

---

## [Why Pyplot in VScode shows nothing?](https://discourse.julialang.org/t/why-pyplot-in-vscode-shows-nothing/75043)

<div class="topic-metadata">

**Author:** [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Replies:** 0\
**Last updated:** [January 22, 2022, 6:53pm UTC](https://discourse.julialang.org/t/why-pyplot-in-vscode-shows-nothing/75043 "2022-01-22T18:53:38Z")

</div>

Hi, I’m trying t run the following code: using PyPlot # Preparing a figure object fig = figure() # Data x = range(0, stop=2\*pi, length=1000) y = sin.(3\*x) # Plotting with linewidth and linestyle specified plot(x, y,…

---

## [Python stdout from PyCall](https://discourse.julialang.org/t/python-stdout-from-pycall/75036)

<div class="topic-metadata">

**Author:** [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Replies:** 2\
**Last updated:** [January 22, 2022, 5:50pm UTC](https://discourse.julialang.org/t/python-stdout-from-pycall/75036 "2022-01-22T17:50:39Z")

</div>

Hi all I’m using PyCall to run a whole script. julia\> @pyinclude("test\_print.py") The script prints out a stream of data to Python stdout print( date\_test ,"^ ", telle, norman,) How do I access python stdout from t…

---

## [How to execute code depending on julia version](https://discourse.julialang.org/t/how-to-execute-code-depending-on-julia-version/75029)

<div class="topic-metadata">

**Author:** [@bgctw](https://discourse.julialang.org/u/bgctw)\
**Replies:** 4\
**Last updated:** [January 22, 2022, 5:18pm UTC](https://discourse.julialang.org/t/how-to-execute-code-depending-on-julia-version/75029 "2022-01-22T17:18:52Z")

</div>

How can I conditionally execute some code, depending on what julia version it is running on? Specifically I test for type stability using @inferred. For some code this succeeds in Julia 1.7 but fails in Julia 1.6. Inst…

---

## [MLJ KNNRegressor BruteTree broken for predict-- load error brutetree has no field indices...?](https://discourse.julialang.org/t/mlj-knnregressor-brutetree-broken-for-predict-load-error-brutetree-has-no-field-indices/74837)

<div class="topic-metadata">

**Author:** [@diadora77](https://discourse.julialang.org/u/diadora77)\
**Replies:** 4\
**Last updated:** [January 22, 2022, 5:02pm UTC](https://discourse.julialang.org/t/mlj-knnregressor-brutetree-broken-for-predict-load-error-brutetree-has-no-field-indices/74837 "2022-01-22T17:02:51Z")

</div>

Using MLJ’s NearestNeighbors KNNRegressor and attempted to use BruteTree algorithm. Get the following error when attempting to use predict: ERROR: LoadError: type BruteTree has no field indices followed by usual stack t…

---

## [Repeated multithreaded region](https://discourse.julialang.org/t/repeated-multithreaded-region/75037)

<div class="topic-metadata">

**Author:** [@bjack205](https://discourse.julialang.org/u/bjack205)\
**Replies:** 2\
**Last updated:** [January 22, 2022, 4:13pm UTC](https://discourse.julialang.org/t/repeated-multithreaded-region/75037 "2022-01-22T16:13:28Z")

</div>

I’m wondering what the best way to repeatedly call a parallelized piece of code in a serial loop? For example, in smooth nonlinear optimization, we often need to calculate an expansion of objective and constraints about …

---

## [Communication with python and etc](https://discourse.julialang.org/t/communication-with-python-and-etc/74767)

<div class="topic-metadata">

**Author:** [@Machine-Teacher](https://discourse.julialang.org/u/Machine-Teacher)\
**Replies:** 16\
**Last updated:** [January 22, 2022, 3:10pm UTC](https://discourse.julialang.org/t/communication-with-python-and-etc/74767 "2022-01-22T15:10:54Z")

</div>

I have an interactive python script that writes to and asks for input from the terminal multiple times. Is there an easy way to interact with it? I tried to redirect input and output through Pipe and PipeBuffer but could…

---

## [Incorporating time lag in observation models](https://discourse.julialang.org/t/incorporating-time-lag-in-observation-models/75002)

<div class="topic-metadata">

**Author:** [@vembha](https://discourse.julialang.org/u/vembha)\
**Replies:** 3\
**Last updated:** [January 22, 2022, 12:57pm UTC](https://discourse.julialang.org/t/incorporating-time-lag-in-observation-models/75002 "2022-01-22T12:57:47Z")

</div>

Hello. I am estimating parameters of a simple SIR epidemic model (shown below) by fitting the model to a known time series data: Deterministic model: function SIR\_model(du, u, p, t) S, I, R = u β, γ = p du…

---

## [Impose two conditions on parametric type](https://discourse.julialang.org/t/impose-two-conditions-on-parametric-type/75028)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 4\
**Last updated:** [January 22, 2022, 12:34pm UTC](https://discourse.julialang.org/t/impose-two-conditions-on-parametric-type/75028 "2022-01-22T12:34:29Z")

</div>

I have a type defined as \_NumericalInput = Union{Float64, Vector{Float64}}. I’d like to implement a function like: get(x::Float64, t::Int) = x get(x::Vector{Float64}, t::Int) = x\[t\] But as soon as I change \_NumericalI…

---

## [How to check if a column is categorical in dataframes](https://discourse.julialang.org/t/how-to-check-if-a-column-is-categorical-in-dataframes/43830)

<div class="topic-metadata">

**Author:** [@satyabrata\_pal](https://discourse.julialang.org/u/satyabrata_pal)\
**Replies:** 6\
**Last updated:** [January 22, 2022, 11:39am UTC](https://discourse.julialang.org/t/how-to-check-if-a-column-is-categorical-in-dataframes/43830 "2022-01-22T11:39:12Z")

</div>

How to check if a dataframw column is categorical? │ Row │ A │ B │ │ │ Cat… │ String │ ├─────┼──────┼────────┤ │ 1 │ A │ X │ │ 2 │ B │ X │ │ 3 │ C │ X │ │ 4 │ D │ Y …

---

## [Broke my Module?](https://discourse.julialang.org/t/broke-my-module/74964)

<div class="topic-metadata">

**Author:** [@TI36XPro](https://discourse.julialang.org/u/TI36XPro)\
**Replies:** 2\
**Last updated:** [January 22, 2022, 10:46am UTC](https://discourse.julialang.org/t/broke-my-module/74964 "2022-01-22T10:46:11Z")

</div>

I wrote my own module that contains various structs and methods which act on them. My typical process is to have on the left a script that loads my module and on the right the module source code. I have been using Revise…

---

## [Reducing the memory allocation in ODEs](https://discourse.julialang.org/t/reducing-the-memory-allocation-in-odes/74402)

<div class="topic-metadata">

**Author:** [@xspeng](https://discourse.julialang.org/u/xspeng)\
**Replies:** 11\
**Last updated:** [January 22, 2022, 2:36am UTC](https://discourse.julialang.org/t/reducing-the-memory-allocation-in-odes/74402 "2022-01-22T02:36:53Z")

</div>

Just coming from Matlab, to pursue faster speed. Here is my problem and a simple case Even run for the second time(after compilation), there are still thousands of allocation, any suggestions are welcome function Eq(dy…

---

## [Only explicit solvers work for stiff PDE-derived ODEs, stiff solvers crashing](https://discourse.julialang.org/t/only-explicit-solvers-work-for-stiff-pde-derived-odes-stiff-solvers-crashing/74907)

<div class="topic-metadata">

**Author:** [@ash](https://discourse.julialang.org/u/ash)\
**Replies:** 11\
**Last updated:** [January 22, 2022, 2:05am UTC](https://discourse.julialang.org/t/only-explicit-solvers-work-for-stiff-pde-derived-odes-stiff-solvers-crashing/74907 "2022-01-22T02:05:04Z")

</div>

I apologize for posting about this PDE many times over the past few days, but I am pursuing several different approaches and each comes with its own issues. The system is given by: \\begin{gathered} \\frac{\\partial c\_{1…

---

## [How to reset slider value](https://discourse.julialang.org/t/how-to-reset-slider-value/75016)

<div class="topic-metadata">

**Author:** [@das](https://discourse.julialang.org/u/das)\
**Replies:** 0\
**Last updated:** [January 21, 2022, 11:38pm UTC](https://discourse.julialang.org/t/how-to-reset-slider-value/75016 "2022-01-21T23:38:34Z")

</div>

Hi everyone, I need to set, read, and reset the value of a slider (using Gtk.jl). To set the value I use: notesSlider = slider(1:200, value = 1) To read the value I use: v = value(signal(notesSlider) but I’ve had not…

---

## [How to decompose a DatePeriod or TimePeriod in tuple of (Y,m,d,H,M,S,s)?](https://discourse.julialang.org/t/how-to-decompose-a-dateperiod-or-timeperiod-in-tuple-of-y-m-d-h-m-s-s/74929)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 4\
**Last updated:** [January 21, 2022, 1:54pm UTC](https://discourse.julialang.org/t/how-to-decompose-a-dateperiod-or-timeperiod-in-tuple-of-y-m-d-h-m-s-s/74929 "2022-01-21T13:54:37Z")

</div>

using Dates longPeriod = Date(2024,6,1) - Date(2022,1,20) How can I decompose longPeriod (or a TimePeriod) in a tuple of (years,months,days,hours,minutes,seconds,milliseconds) ? I know canLongPeriod = Dates.canonicaliz…

[Previous page](https://discourse.julialang.org/latest.md?page=1143)

[Next page](https://discourse.julialang.org/latest.md?page=1145)
