# General Usage

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

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

**Page:** 552

---

## [Choosing distinct categorical colors that all work with opposing black gradients](https://discourse.julialang.org/t/choosing-distinct-categorical-colors-that-all-work-with-opposing-black-gradients/67596)

<div class="topic-metadata">

**Author:** [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Replies:** 1\
**Last updated:** [September 2, 2021, 7:54pm UTC](https://discourse.julialang.org/t/choosing-distinct-categorical-colors-that-all-work-with-opposing-black-gradients/67596 "2021-09-02T19:54:42Z")

</div>

I’d like to use something like :batlow to choose 3 categorical colors, each to use in a color gradient against black, but some are too dark for enough contrast. How can I simply lighten the first two? using Plots, Image…

---

## [Environment variable for BLAS.set\_num\_threads default?](https://discourse.julialang.org/t/environment-variable-for-blas-set-num-threads-default/67594)

<div class="topic-metadata">

**Author:** [@goerz](https://discourse.julialang.org/u/goerz)\
**Replies:** 1\
**Last updated:** [September 2, 2021, 6:54pm UTC](https://discourse.julialang.org/t/environment-variable-for-blas-set-num-threads-default/67594 "2021-09-02T18:54:36Z")

</div>

Is there an environment variable that I can set in my .bashrc so I don’t have to manually prevent multiple BLAS threads (BLAS.set\_num\_threads(1)) in every program? I never, ever want BLAS to run in multithreaded mode. I…

---

## [3d Plots with PlotlyJS](https://discourse.julialang.org/t/3d-plots-with-plotlyjs/67543)

<div class="topic-metadata">

**Author:** [@donkeysaddle](https://discourse.julialang.org/u/donkeysaddle)\
**Replies:** 2\
**Last updated:** [September 2, 2021, 5:27pm UTC](https://discourse.julialang.org/t/3d-plots-with-plotlyjs/67543 "2021-09-02T17:27:20Z")

</div>

I can produce beautiful 3d plots with Plots.jl. For example, using Plots x1 = 1:.001:2pi y1 = cos.(1:.001:2pi) z1 = sin.(1:.001:2pi) x2 = 1:.001:2pi y2 = 2\*sin.(1:.001:2pi) z2 = cos.(1:.001:2pi) x3 = 1:.001:2pi y3 =…

---

## [NaN Data Frame with labels and indexes](https://discourse.julialang.org/t/nan-data-frame-with-labels-and-indexes/67588)

<div class="topic-metadata">

**Author:** [@Jdbeck66](https://discourse.julialang.org/u/Jdbeck66)\
**Replies:** 2\
**Last updated:** [September 2, 2021, 4:15pm UTC](https://discourse.julialang.org/t/nan-data-frame-with-labels-and-indexes/67588 "2021-09-02T16:15:31Z")

</div>

I’m trying to make a data frame of NaN with set labels and indexes. I can’t find in the documentation how to do this. Here is what I would do in Pandas: label = \["1T", "1G", "1C", "2T", "2G", "2A"\] rescue\_left = pd.Dat…

---

## [Diffeq trigger callback from inside f](https://discourse.julialang.org/t/diffeq-trigger-callback-from-inside-f/67499)

<div class="topic-metadata">

**Author:** [@levasco](https://discourse.julialang.org/u/levasco)\
**Replies:** 2\
**Last updated:** [September 2, 2021, 4:01pm UTC](https://discourse.julialang.org/t/diffeq-trigger-callback-from-inside-f/67499 "2021-09-02T16:01:53Z")

</div>

I am looking to improve the performance of my ODE. Since the expensive operation g(u,p) (which involves inverting matrices) has to be done anyway to calculate du/dt, I’d like not to have to reevaluate it at every step fo…

---

## [Passing struct vs struct fields as function arguments](https://discourse.julialang.org/t/passing-struct-vs-struct-fields-as-function-arguments/67584)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 5\
**Last updated:** [September 2, 2021, 4:01pm UTC](https://discourse.julialang.org/t/passing-struct-vs-struct-fields-as-function-arguments/67584 "2021-09-02T16:01:36Z")

</div>

Hi, I have noticed that passing struct fields as function arguments generally results in better performance compared to passing the struct directly. For instance, using BenchmarkTools; using Random; struct MyStruct …

---

## [PyCall error I don't understand](https://discourse.julialang.org/t/pycall-error-i-dont-understand/67571)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 4\
**Last updated:** [September 2, 2021, 3:35pm UTC](https://discourse.julialang.org/t/pycall-error-i-dont-understand/67571 "2021-09-02T15:35:01Z")

</div>

Hi all, I’ve got an error I don’t understand. It happends every couple of minutes. Can anyone help? So what I did: I use PyCall.jl with boto3 to upload to s3. Before that I use JSON.jl to serialise. The data structure…

---

## [Julia vs C++ speed](https://discourse.julialang.org/t/julia-vs-c-speed/67219)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 21\
**Last updated:** [September 2, 2021, 3:25pm UTC](https://discourse.julialang.org/t/julia-vs-c-speed/67219 "2021-09-02T15:25:46Z")

</div>

Hi! I am currently doing a very “nice” project of converting algorithms written in Julia to C++ :cry: I need those algorithms in an embedded environment and, unfortunately, Julia cannot generate compiled code that can b…

---

## [Avoiding memory allocation with function passed as argument](https://discourse.julialang.org/t/avoiding-memory-allocation-with-function-passed-as-argument/67494)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 14\
**Last updated:** [September 2, 2021, 3:19pm UTC](https://discourse.julialang.org/t/avoiding-memory-allocation-with-function-passed-as-argument/67494 "2021-09-02T15:19:56Z")

</div>

Consider the code at the bottom. The actual case is more complex, so something that does not depend on the definition of the function A would be appreciated. This gives the time and allocation numbers below. Presumabl…

---

## [Way to give DataFrame columns nicknames?](https://discourse.julialang.org/t/way-to-give-dataframe-columns-nicknames/67575)

<div class="topic-metadata">

**Author:** [@Nathan\_Boyer](https://discourse.julialang.org/u/Nathan_Boyer)\
**Replies:** 8\
**Last updated:** [September 2, 2021, 2:40pm UTC](https://discourse.julialang.org/t/way-to-give-dataframe-columns-nicknames/67575 "2021-09-02T14:40:57Z")

</div>

I am importing data from Excel into a DataFrame. The column headers are long specific names with spaces and units. They are a pain to work with because every time I need to access that column, I have to type df."Long Spe…

---

## [Retrieve the type of \`AbstractDict\` (without parameters) from a concrete dictionary type](https://discourse.julialang.org/t/retrieve-the-type-of-abstractdict-without-parameters-from-a-concrete-dictionary-type/67567)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 4\
**Last updated:** [September 2, 2021, 1:07pm UTC](https://discourse.julialang.org/t/retrieve-the-type-of-abstractdict-without-parameters-from-a-concrete-dictionary-type/67567 "2021-09-02T13:07:43Z")

</div>

I want a function that takes an AbstractDict (it might be either Dict, an OrderedDict, etc.), and returns a dictionary of the same type, except for its parameters (the types of keys and values may differ). I fancied that…

---

## [Cannot update package in empty environment](https://discourse.julialang.org/t/cannot-update-package-in-empty-environment/67565)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 3\
**Last updated:** [September 2, 2021, 11:49am UTC](https://discourse.julialang.org/t/cannot-update-package-in-empty-environment/67565 "2021-09-02T11:49:41Z")

</div>

I want to update a package to the most recent version. For some reason, the most recent version does not seem to be recognized. Here is an example using an empty environment: (@v1.6) pkg\> st Status \`~/.julia/envir…

---

## [Julia sum issue](https://discourse.julialang.org/t/julia-sum-issue/67566)

<div class="topic-metadata">

**Author:** [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)\
**Replies:** 2\
**Last updated:** [September 2, 2021, 11:48am UTC](https://discourse.julialang.org/t/julia-sum-issue/67566 "2021-09-02T11:48:30Z")

</div>

Hi In the below code I am getting wrong summation output zz=sum((M\_B\_DG\_400\[bb,t,c,p\]\*C\_s\[c\]) for p in 1:P, t in 1:T, bb in 1:b) if the value of M\_B\_DG\_400\[bb,t,c,p\] is zero then value zz should be zero. But it is not…

---

## [How to specify the number of execution and the number of repetitions per execution in BenchmarkTools?](https://discourse.julialang.org/t/how-to-specify-the-number-of-execution-and-the-number-of-repetitions-per-execution-in-benchmarktools/34514)

<div class="topic-metadata">

**Author:** [@PyDataBlog](https://discourse.julialang.org/u/PyDataBlog)\
**Replies:** 16\
**Last updated:** [September 2, 2021, 9:19am UTC](https://discourse.julialang.org/t/how-to-specify-the-number-of-execution-and-the-number-of-repetitions-per-execution-in-benchmarktools/34514 "2021-09-02T09:19:57Z")

</div>

Hi everyone, I’m trying to benchmark the speed of a function that I ported to Julia using BenchmarkTools. In Python with ipython, I used %timeit -n 7 test\_speed(X) to generate the benchmark speeds with this result; 1…

---

## [Adding Sliders on Scenes in GLMakie](https://discourse.julialang.org/t/adding-sliders-on-scenes-in-glmakie/67520)

<div class="topic-metadata">

**Author:** [@jg-854](https://discourse.julialang.org/u/jg-854)\
**Replies:** 2\
**Last updated:** [September 2, 2021, 8:47am UTC](https://discourse.julialang.org/t/adding-sliders-on-scenes-in-glmakie/67520 "2021-09-02T08:47:35Z")

</div>

It seems the Makie documentation has updated and there is no longer a textslider structure… http://makie.juliaplots.org/v0.15.2/examples/layoutables/slider/index.html I want to know how I would be able to attach a slid…

---

## [Reverting back in time (like using a time capsule)](https://discourse.julialang.org/t/reverting-back-in-time-like-using-a-time-capsule/67556)

<div class="topic-metadata">

**Author:** [@martin.demare](https://discourse.julialang.org/u/martin.demare)\
**Replies:** 0\
**Last updated:** [September 2, 2021, 8:32am UTC](https://discourse.julialang.org/t/reverting-back-in-time-like-using-a-time-capsule/67556 "2021-09-02T08:32:56Z")

</div>

Hi, While i was trouble-shooting a precompile error I tried figuring out which packages might work well together by looking at the release date on Git, however pinning package after package manually based on the Git-dat…

---

## [How to print human-readable macro expansion?](https://discourse.julialang.org/t/how-to-print-human-readable-macro-expansion/67518)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 5\
**Last updated:** [September 1, 2021, 8:45pm UTC](https://discourse.julialang.org/t/how-to-print-human-readable-macro-expansion/67518 "2021-09-01T20:45:10Z")

</div>

Sometimes I’d like to check what a macro is doing, by displaying its expansion. For simple cases, this is not a problem: julia\> @macroexpand(@assert 0\<1) :(if 0 \< 1 nothing else Base.throw(Base.AssertionEr…

---

## [Output sparse matrix to csv](https://discourse.julialang.org/t/output-sparse-matrix-to-csv/67513)

<div class="topic-metadata">

**Author:** [@Nenndul](https://discourse.julialang.org/u/Nenndul)\
**Replies:** 25\
**Last updated:** [September 1, 2021, 9:46pm UTC](https://discourse.julialang.org/t/output-sparse-matrix-to-csv/67513 "2021-09-01T21:46:33Z")

</div>

I have a little program that correctly produces a sparse matrix from data. When I call the result: display(dataOut) I get the expected: 3×3 SparseMatrixCSC{Float64, Int64} with 3 stored entries: -1.0 -1.0 ⋅ -1.…

---

## [Save dispatched function for later call](https://discourse.julialang.org/t/save-dispatched-function-for-later-call/67218)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 46\
**Last updated:** [September 1, 2021, 8:32pm UTC](https://discourse.julialang.org/t/save-dispatched-function-for-later-call/67218 "2021-09-01T20:32:54Z")

</div>

Hey Julianners, Is it possible to save a function call like? “Base.+” but the dispatched version like: +(::Float32, ::Float32)

---

## [Relatively complex function breaking with Zygote - what limitations exist for differential programming?](https://discourse.julialang.org/t/relatively-complex-function-breaking-with-zygote-what-limitations-exist-for-differential-programming/67377)

<div class="topic-metadata">

**Author:** [@winterismute](https://discourse.julialang.org/u/winterismute)\
**Replies:** 5\
**Last updated:** [September 1, 2021, 8:07pm UTC](https://discourse.julialang.org/t/relatively-complex-function-breaking-with-zygote-what-limitations-exist-for-differential-programming/67377 "2021-09-01T20:07:23Z")

</div>

Hello, I am new to Julia (although not really to programming) and not a top-brain in calculus or statistical learning - although I think I have enough background to understand complex stuff if I put a bit of time …

---

## [High-order derivatives of sampled data](https://discourse.julialang.org/t/high-order-derivatives-of-sampled-data/67045)

<div class="topic-metadata">

**Author:** [@DanielIngraham](https://discourse.julialang.org/u/DanielIngraham)\
**Replies:** 9\
**Last updated:** [September 1, 2021, 5:38pm UTC](https://discourse.julialang.org/t/high-order-derivatives-of-sampled-data/67045 "2021-09-01T17:38:53Z")

</div>

Hi, I have discrete data sampled at a constant rate. I need the first, second, and third derivatives with respect to time. Is there a Julia package that could help me do that? Things that I’ve considered so far: Use f…

---

## [Corrplot issue](https://discourse.julialang.org/t/corrplot-issue/37161)

<div class="topic-metadata">

**Author:** [@Alfre\_chile77](https://discourse.julialang.org/u/Alfre_chile77)\
**Replies:** 2\
**Last updated:** [September 1, 2021, 4:57pm UTC](https://discourse.julialang.org/t/corrplot-issue/37161 "2021-09-01T16:57:27Z")

</div>

Hello, I am trying to use StatsPlots.corrplot for some analysis, but every time the plot shows the 2d Histogram (upper right plot) just black, with no different coloring for the color gradient. Is there a way to change…

---

## [For Monte Carlo simulation with same code same algorithm, how fast is Julia compared with Fortran?](https://discourse.julialang.org/t/for-monte-carlo-simulation-with-same-code-same-algorithm-how-fast-is-julia-compared-with-fortran/67021)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 59\
**Last updated:** [September 1, 2021, 4:12pm UTC](https://discourse.julialang.org/t/for-monte-carlo-simulation-with-same-code-same-algorithm-how-fast-is-julia-compared-with-fortran/67021 "2021-09-01T16:12:17Z")

</div>

I have just translated my own Monte Carlo parametric expectation maximization (doing Monte Carlo in each iterations) code from modern to Fortran to Julia. This is basically a one to one translation and algorithm and code…

---

## [EnvironmentLocationNotFound: Not a conda environment](https://discourse.julialang.org/t/environmentlocationnotfound-not-a-conda-environment/67511)

<div class="topic-metadata">

**Author:** [@imantha](https://discourse.julialang.org/u/imantha)\
**Replies:** 0\
**Last updated:** [September 1, 2021, 3:14pm UTC](https://discourse.julialang.org/t/environmentlocationnotfound-not-a-conda-environment/67511 "2021-09-01T15:14:15Z")

</div>

Hi, I am attempting use Python via Conda.jl but get the following error EnvironmentLocationNotFound: Not a conda environment: /Users/imantha/.julia/conda/3/bin Using Conda env = Conda.PYTHONDIR # Out \> "/Users/imantha/…

---

## [Problem building Proj4 package (LoadError: ArgumentError: Will not install a tarball of platform...)](https://discourse.julialang.org/t/problem-building-proj4-package-loaderror-argumenterror-will-not-install-a-tarball-of-platform/67504)

<div class="topic-metadata">

**Author:** [@yodefiar](https://discourse.julialang.org/u/yodefiar)\
**Replies:** 0\
**Last updated:** [September 1, 2021, 2:07pm UTC](https://discourse.julialang.org/t/problem-building-proj4-package-loaderror-argumenterror-will-not-install-a-tarball-of-platform/67504 "2021-09-01T14:07:47Z")

</div>

Hi I’m having problem building Proj4 package, it kept returning the error below (@v1.6) pkg\> build Proj4 Building Proj4 → \`C:\\Users\\Yodefia Rahmad\\.julia\\scratchspaces\\44cfe95a-1eb2-52ea-b672-e2afdf69b78f\\6a52f9d89…

---

## [How to enforce spawned tasks to be run on different threads?](https://discourse.julialang.org/t/how-to-enforce-spawned-tasks-to-be-run-on-different-threads/67496)

<div class="topic-metadata">

**Author:** [@erwanlecarpentier](https://discourse.julialang.org/u/erwanlecarpentier)\
**Replies:** 4\
**Last updated:** [September 1, 2021, 1:48pm UTC](https://discourse.julialang.org/t/how-to-enforce-spawned-tasks-to-be-run-on-different-threads/67496 "2021-09-01T13:48:22Z")

</div>

Hey! I would like to run a job several times in parallel (as many times as the number of available threads), and I would like to do this several times in a row. MWE: function mytask() # The task to be parallelized …

---

## [Problem about SDDE solver in differentialequation.jl](https://discourse.julialang.org/t/problem-about-sdde-solver-in-differentialequation-jl/67495)

<div class="topic-metadata">

**Author:** [@Liwei17](https://discourse.julialang.org/u/Liwei17)\
**Replies:** 1\
**Last updated:** [September 1, 2021, 12:13pm UTC](https://discourse.julialang.org/t/problem-about-sdde-solver-in-differentialequation-jl/67495 "2021-09-01T12:13:47Z")

</div>

Basically, I’m running a SDDE solver. tspan = (0, 50000); prob = SDDEProblem(f, g, u0, h, tspan, p; constant\_lags = lag); sol = solve(prob, RKMil()); I want to get the corresponding tspan time point in “sol”. But I fo…

---

## [Can't get CSV package working in 1.6.2](https://discourse.julialang.org/t/cant-get-csv-package-working-in-1-6-2/67490)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 1\
**Last updated:** [September 1, 2021, 11:33am UTC](https://discourse.julialang.org/t/cant-get-csv-package-working-in-1-6-2/67490 "2021-09-01T11:33:32Z")

</div>

After standard installation of 1.6.2 on Ubuntu 20, I tried adding and (later) building the CSV package. Each ran OK but failed on invocations of ‘using’. using CSV \\u250c Info: Precompiling CSV \[336ed68f-0bac-5ca0-87…

---

## [Speed up matrix multiplication with permuted vector](https://discourse.julialang.org/t/speed-up-matrix-multiplication-with-permuted-vector/67491)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Replies:** 5\
**Last updated:** [September 1, 2021, 11:24am UTC](https://discourse.julialang.org/t/speed-up-matrix-multiplication-with-permuted-vector/67491 "2021-09-01T11:24:51Z")

</div>

I have a very large sparse matrix of the order (1768, 39816100) that goes into the following (part of Computing sparse orthogonal projections - #2 by stevengj): QR = qr(A::SparseMatrixCSC) # A = sparse matrix of size (1…

---

## [Where is my memory usage coming from](https://discourse.julialang.org/t/where-is-my-memory-usage-coming-from/67351)

<div class="topic-metadata">

**Author:** [@maarten\_van\_damme](https://discourse.julialang.org/u/maarten_van_damme)\
**Replies:** 12\
**Last updated:** [September 1, 2021, 9:33am UTC](https://discourse.julialang.org/t/where-is-my-memory-usage-coming-from/67351 "2021-09-01T09:33:31Z")

</div>

While developing a package, I noticed that a simulation that used to run without problems now takes a whopping 30+ gb. The script is rather simple, I use some packages and then execute a let block. There should be no lea…

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

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