# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=492

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

**Page:** 493

---

## [Problem about Makie Legend](https://discourse.julialang.org/t/problem-about-makie-legend/75064)

<div class="topic-metadata">

**Author:** [@aachener](https://discourse.julialang.org/u/aachener)\
**Replies:** 1\
**Last updated:** [January 23, 2022, 7:46pm UTC](https://discourse.julialang.org/t/problem-about-makie-legend/75064 "2022-01-23T19:46:33Z")

</div>

Hi, guys I am trying to replicate the following code from the book Julia Data Science. I got a problem when I wanted to add a legend for the chart of the series() part, and put it below the chart horizontally, not in …

---

## [CSV.jl fails precompling, TypeError: in Type{...} expression, expected UnionAll, got Type{Parsers.Options}](https://discourse.julialang.org/t/csv-jl-fails-precompling-typeerror-in-type-expression-expected-unionall-got-type-parsers-options/67195)

<div class="topic-metadata">

**Author:** [@erickn](https://discourse.julialang.org/u/erickn)\
**Replies:** 19\
**Last updated:** [December 8, 2021, 4:48am UTC](https://discourse.julialang.org/t/csv-jl-fails-precompling-typeerror-in-type-expression-expected-unionall-got-type-parsers-options/67195 "2021-12-08T04:48:04Z")

</div>

Hi all, Yesterday I found that CSV.jl is failing in precompiling when it is imported in a Jupyter notebook. For testing, it is tried in a new environment only with CSV, but it failed the same way. See below for the erro…

---

## [Franklin.jl relative links](https://discourse.julialang.org/t/franklin-jl-relative-links/75074)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [January 23, 2022, 5:17pm UTC](https://discourse.julialang.org/t/franklin-jl-relative-links/75074 "2022-01-23T17:17:53Z")

</div>

I am migrating a site from Hugo to Franklin. Hugo has a special syntax for links, but in for Franklin.jl would one just use Markdown for both absolute or relative links? Eg as in \[some page within the site\](/pages/blog/…

---

## [Boolean function minimization / reduction](https://discourse.julialang.org/t/boolean-function-minimization-reduction/36463)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 4\
**Last updated:** [January 23, 2022, 4:53pm UTC](https://discourse.julialang.org/t/boolean-function-minimization-reduction/36463 "2022-01-23T16:53:20Z")

</div>

Hi All, I am working on explanation of neural networks for computer security. Specifically, I would like to combine several alternative explanations together in one logical formula. I would like to ask, if anyone has ex…

---

## [CUDA/AMD/CPU device agnostic array creation best practice](https://discourse.julialang.org/t/cuda-amd-cpu-device-agnostic-array-creation-best-practice/75059)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 9\
**Last updated:** [January 23, 2022, 3:42pm UTC](https://discourse.julialang.org/t/cuda-amd-cpu-device-agnostic-array-creation-best-practice/75059 "2022-01-23T15:42:43Z")

</div>

Dear Julianners, What is the best practice to do a device agnostic array initialisation. I believe this package written by many person already. For example: get\_worker\_type() = :CUDA # This is actually a function tha…

---

## [How to delploy Documenter-generated documentation on a project that is not a package?](https://discourse.julialang.org/t/how-to-delploy-documenter-generated-documentation-on-a-project-that-is-not-a-package/75006)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [January 23, 2022, 1:37pm UTC](https://discourse.julialang.org/t/how-to-delploy-documenter-generated-documentation-on-a-project-that-is-not-a-package/75006 "2022-01-23T13:37:38Z")

</div>

Hello, I am trying to use Documenter (and Literate) for a github-based Julia course (so, not a package) When I run the documentation building script locally, I got it without problem and the documentation is built local…

---

## [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, …

---

## [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…

---

## [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…

---

## [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,…

---

## [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…

---

## [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…

---

## [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…

---

## [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…

---

## [Matrix multiplication is slower when multithreading in Julia](https://discourse.julialang.org/t/matrix-multiplication-is-slower-when-multithreading-in-julia/56227)

<div class="topic-metadata">

**Author:** [@pablof300](https://discourse.julialang.org/u/pablof300)\
**Replies:** 13\
**Last updated:** [January 21, 2022, 10:26pm UTC](https://discourse.julialang.org/t/matrix-multiplication-is-slower-when-multithreading-in-julia/56227 "2022-01-21T22:26:46Z")

</div>

I am working with big matrices (size of 30k rows and ~100 columns). I am doing some matrix multiplication and the process would take around 20 seconds. This is my code: @time begin result = -1 data =…

---

## [LegacyStrings.UTF8String](https://discourse.julialang.org/t/legacystrings-utf8string/75010)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 1\
**Last updated:** [January 21, 2022, 9:53pm UTC](https://discourse.julialang.org/t/legacystrings-utf8string/75010 "2022-01-21T21:53:32Z")

</div>

Core.String is a utf8 string written in C. What is the difference between it and LegacyStrings.UTF8String?

---

## [Splat ComponentArray into keyword arguments](https://discourse.julialang.org/t/splat-componentarray-into-keyword-arguments/75003)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 4\
**Last updated:** [January 21, 2022, 9:03pm UTC](https://discourse.julialang.org/t/splat-componentarray-into-keyword-arguments/75003 "2022-01-21T21:03:53Z")

</div>

Hi all, I have a situation in which “splatting” a ComponentArray into keyword arguments would be useful. Unfortunately, it is not currently possible. I was wondering whether it would be possible in principle? Could I ad…

---

## [Bug with Winston 0.15.2 and julia 1.7.1?](https://discourse.julialang.org/t/bug-with-winston-0-15-2-and-julia-1-7-1/75005)

<div class="topic-metadata">

**Author:** [@harven](https://discourse.julialang.org/u/harven)\
**Replies:** 0\
**Last updated:** [January 21, 2022, 8:44pm UTC](https://discourse.julialang.org/t/bug-with-winston-0-15-2-and-julia-1-7-1/75005 "2022-01-21T20:44:39Z")

</div>

I have upgraded to julia 1.7.1 and I encounter a weird error perhaps related to the Winston library. julia\> using Winston julia\> flatten6(A) = \[\[isa(x,Array) ? flatten6(x) : x for x in A\]...;\] flatten6 (generi…

---

## [Transform! to destructure NamedTuple into columns](https://discourse.julialang.org/t/transform-to-destructure-namedtuple-into-columns/74991)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 7\
**Last updated:** [January 21, 2022, 5:15pm UTC](https://discourse.julialang.org/t/transform-to-destructure-namedtuple-into-columns/74991 "2022-01-21T17:15:42Z")

</div>

Hi all, I would like to destructure a DataFrame with NamedTuples into separate columns, using the keys as column names. For a similar problem with an array, I used something like transform!(df, :col =\> :identity =\> new\_…

---

## [Adding a sysimage to a julia script - Package Complier](https://discourse.julialang.org/t/adding-a-sysimage-to-a-julia-script-package-complier/74994)

<div class="topic-metadata">

**Author:** [@maulik.bhatt](https://discourse.julialang.org/u/maulik.bhatt)\
**Replies:** 0\
**Last updated:** [January 21, 2022, 4:56pm UTC](https://discourse.julialang.org/t/adding-a-sysimage-to-a-julia-script-package-complier/74994 "2022-01-21T16:56:41Z")

</div>

I have a Julia script which uses several packages and runs several functions from them. This Julia script takes a lot of time every time I run it because every package is precompiled in julia every time I run that script…

---

## [Error deploying in AWS Lambda and Google Cloud Run](https://discourse.julialang.org/t/error-deploying-in-aws-lambda-and-google-cloud-run/60959)

<div class="topic-metadata">

**Author:** [@pedroferraz](https://discourse.julialang.org/u/pedroferraz)\
**Replies:** 5\
**Last updated:** [January 21, 2022, 4:24pm UTC](https://discourse.julialang.org/t/error-deploying-in-aws-lambda-and-google-cloud-run/60959 "2022-01-21T16:24:08Z")

</div>

I am trying to deploy a simple microservice in a docker container with a HTTP server that uses JuMP in AWS Lambda or Google Cloud Run. I based my application’s code in Jacob Quinn’s example from JuliaCon 2020 (JuliaCon 2…

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=491)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=493)
