# General Usage

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

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

**Page:** 558

---

## [PlotlyJS: how to change the aspect ratio of a 3D plot](https://discourse.julialang.org/t/plotlyjs-how-to-change-the-aspect-ratio-of-a-3d-plot/66779)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 5\
**Last updated:** [August 22, 2021, 11:09am UTC](https://discourse.julialang.org/t/plotlyjs-how-to-change-the-aspect-ratio-of-a-3d-plot/66779 "2021-08-22T11:09:31Z")

</div>

I have tried to change the aspect ratio of a typical 3D plot using PlotlyJS. I searched but found no helpful answer to my problem. The MWE below produces a tall and thin cube with the surface in. I want to change the as…

---

## [Know whether a value is a "core" Julia type](https://discourse.julialang.org/t/know-whether-a-value-is-a-core-julia-type/66190)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 10\
**Last updated:** [August 22, 2021, 8:02am UTC](https://discourse.julialang.org/t/know-whether-a-value-is-a-core-julia-type/66190 "2021-08-22T08:02:26Z")

</div>

In the context of serialisation, I’d like to know if a given variable has type part of Julia’s “core types” (i.e. does not depend on a user-defined type or an external lib). The context is that I’d like to have a differe…

---

## [Pointwise getproperty](https://discourse.julialang.org/t/pointwise-getproperty/66806)

<div class="topic-metadata">

**Author:** [@peteole](https://discourse.julialang.org/u/peteole)\
**Replies:** 1\
**Last updated:** [August 22, 2021, 3:52pm UTC](https://discourse.julialang.org/t/pointwise-getproperty/66806 "2021-08-22T15:52:02Z")

</div>

Hi, I am thinking about the neatest way to neatest way to project an iterable of structs to an iterable of a member of each of these structs. For example: struct Point x::Int y::Int end points=\[Point(1,11),Point(2,12)\]…

---

## [How to correct a package "building" error?](https://discourse.julialang.org/t/how-to-correct-a-package-building-error/66746)

<div class="topic-metadata">

**Author:** [@r0b0ty](https://discourse.julialang.org/u/r0b0ty)\
**Replies:** 1\
**Last updated:** [August 22, 2021, 2:39pm UTC](https://discourse.julialang.org/t/how-to-correct-a-package-building-error/66746 "2021-08-22T14:39:06Z")

</div>

Hello everyone. I’m new to the Julia community and in the process of going through various tutorials. During a packages update to the Julia-DataFrames-Tutorial, I obtained a segmentation fault and the update aborts. (…

---

## [Any suggestions for speeding this simple scalar function up?](https://discourse.julialang.org/t/any-suggestions-for-speeding-this-simple-scalar-function-up/66748)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 36\
**Last updated:** [August 22, 2021, 2:35pm UTC](https://discourse.julialang.org/t/any-suggestions-for-speeding-this-simple-scalar-function-up/66748 "2021-08-22T14:35:24Z")

</div>

Hi! I’ve been playing around calculating this expression: P = b \* ((rho/rho0)^gamma - 1) Where values for b are shown how to be calculated in the code (see bottom spoiler). Running the different variants I have of the…

---

## [Reverting from development version of project to registered release](https://discourse.julialang.org/t/reverting-from-development-version-of-project-to-registered-release/66802)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 1\
**Last updated:** [August 22, 2021, 2:08pm UTC](https://discourse.julialang.org/t/reverting-from-development-version-of-project-to-registered-release/66802 "2021-08-22T14:08:43Z")

</div>

Sometimes when I am developing a package, I want to see how the changes might affect one of my projects. Typically, I do the following: Activate project environment: \] activate MyProject Switch the development versio…

---

## [JET.jl Invalid Type Signature](https://discourse.julialang.org/t/jet-jl-invalid-type-signature/66719)

<div class="topic-metadata">

**Author:** [@jekyllstein](https://discourse.julialang.org/u/jekyllstein)\
**Replies:** 1\
**Last updated:** [August 22, 2021, 8:07am UTC](https://discourse.julialang.org/t/jet-jl-invalid-type-signature/66719 "2021-08-22T08:07:23Z")

</div>

I was trying to use JET.jl to analyze a package and I ran into a type signature error. I have a toy example that reproduces the same issue. module Test ParamType = Union{Tuple{Real, Vararg{Real, N} where N}, Tuple{Rea…

---

## [Plots.jl GR add space between the colorbar and the colorbar\_title](https://discourse.julialang.org/t/plots-jl-gr-add-space-between-the-colorbar-and-the-colorbar-title/66785)

<div class="topic-metadata">

**Author:** [@josePereiro](https://discourse.julialang.org/u/josePereiro)\
**Replies:** 4\
**Last updated:** [August 22, 2021, 6:10am UTC](https://discourse.julialang.org/t/plots-jl-gr-add-space-between-the-colorbar-and-the-colorbar-title/66785 "2021-08-22T06:10:51Z")

</div>

Hi, how can I control the space between the colorbar and the colorbar\_title? using Plots p = heatmap(rand(100, 100); colorbar\_title = "colorbar title", thickness\_scaling = 1.6, ) savefig(p, "test.png") Im usi…

---

## [Unexpected Allocation with Iterator Extension](https://discourse.julialang.org/t/unexpected-allocation-with-iterator-extension/66566)

<div class="topic-metadata">

**Author:** [@pulsipher](https://discourse.julialang.org/u/pulsipher)\
**Replies:** 2\
**Last updated:** [August 22, 2021, 3:04am UTC](https://discourse.julialang.org/t/unexpected-allocation-with-iterator-extension/66566 "2021-08-22T03:04:57Z")

</div>

I am trying to implement an iterator that acts on heterogenous types whose elements may or may not need to iterated over themselves. Hence, this is sort of a nested iterator. However, I keep running into unexpected alloc…

---

## [OLS: difference between \\ and normal equation (and inv or pinv)](https://discourse.julialang.org/t/ols-difference-between-and-normal-equation-and-inv-or-pinv/66739)

<div class="topic-metadata">

**Author:** [@Alec\_Loudenback](https://discourse.julialang.org/u/Alec_Loudenback)\
**Replies:** 10\
**Last updated:** [August 22, 2021, 12:06am UTC](https://discourse.julialang.org/t/ols-difference-between-and-normal-equation-and-inv-or-pinv/66739 "2021-08-22T00:06:39Z")

</div>

Hello, I am hoping to reference this in an upcoming article on JuliaActuary. Is there something fundamentally different in the above code vs ols(x,y) = x \\ y that would make this syntactically shorter version able to be…

---

## [Julia implementation of seqperiod (from MATLAB)](https://discourse.julialang.org/t/julia-implementation-of-seqperiod-from-matlab/66791)

<div class="topic-metadata">

**Author:** [@MathGuy](https://discourse.julialang.org/u/MathGuy)\
**Replies:** 12\
**Last updated:** [August 21, 2021, 11:50pm UTC](https://discourse.julialang.org/t/julia-implementation-of-seqperiod-from-matlab/66791 "2021-08-21T23:50:37Z")

</div>

Hi! I’ve been playing with Julia for a while. Suppose you are given a 2000-by10000 Matrix of Float64 type and were told to find the periodicity of each of the 10k columns and store it in some variable. Note that, very c…

---

## [Rand and Sampler interface for multiple samples](https://discourse.julialang.org/t/rand-and-sampler-interface-for-multiple-samples/66770)

<div class="topic-metadata">

**Author:** [@fedario](https://discourse.julialang.org/u/fedario)\
**Replies:** 2\
**Last updated:** [August 21, 2021, 6:10pm UTC](https://discourse.julialang.org/t/rand-and-sampler-interface-for-multiple-samples/66770 "2021-08-21T18:10:14Z")

</div>

Hi Julia community! I’m trying to implement the Random.rand function for a custom distribution. That distribution can have different “event” sizes, meaning a single sample could be a scalar, a vector, or in general an …

---

## [Running something atexit after all finalizer](https://discourse.julialang.org/t/running-something-atexit-after-all-finalizer/66778)

<div class="topic-metadata">

**Author:** [@oxinabox](https://discourse.julialang.org/u/oxinabox)\
**Replies:** 3\
**Last updated:** [August 21, 2021, 3:36pm UTC](https://discourse.julialang.org/t/running-something-atexit-after-all-finalizer/66778 "2021-08-21T15:36:27Z")

</div>

I have some finalizers they need to ccall in order to free some external resources. I also have a function I need to call right at the end which completes the tear-down – it undoes something I do in \_\_init\_\_. That at-…

---

## [Efficient use of @turbo for linear algebra operations (LoopVectorization.jl)](https://discourse.julialang.org/t/efficient-use-of-turbo-for-linear-algebra-operations-loopvectorization-jl/66771)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 6\
**Last updated:** [August 21, 2021, 3:04pm UTC](https://discourse.julialang.org/t/efficient-use-of-turbo-for-linear-algebra-operations-loopvectorization-jl/66771 "2021-08-21T15:04:55Z")

</div>

Hi, I am trying to understand how to use the @turbo macro from LoopVectorization.jl efficiently. I am starting with a generalised dot product, as implemented in LinearAlgebra. I basically took the code from LinearAlgeb…

---

## [How to define a file, \`include()\`, and variables globally during \`Distributed.jl\` for loop](https://discourse.julialang.org/t/how-to-define-a-file-include-and-variables-globally-during-distributed-jl-for-loop/66764)

<div class="topic-metadata">

**Author:** [@colebrookson](https://discourse.julialang.org/u/colebrookson)\
**Replies:** 0\
**Last updated:** [August 21, 2021, 5:21am UTC](https://discourse.julialang.org/t/how-to-define-a-file-include-and-variables-globally-during-distributed-jl-for-loop/66764 "2021-08-21T05:21:24Z")

</div>

Hi All, So I’m trying to set up a script to run in parallel on my machine and I’m having some trouble. I’m still new to doing distributed jobs in Julia, so any advice is appreciated :slight\_smile: What I want to have h…

---

## [Avoid memory allocation in passing arrays](https://discourse.julialang.org/t/avoid-memory-allocation-in-passing-arrays/66560)

<div class="topic-metadata">

**Author:** [@Frisus95](https://discourse.julialang.org/u/Frisus95)\
**Replies:** 14\
**Last updated:** [August 21, 2021, 2:14am UTC](https://discourse.julialang.org/t/avoid-memory-allocation-in-passing-arrays/66560 "2021-08-21T02:14:46Z")

</div>

Hello everyone, I’m trying to figure out how to avoid unnecessary memory allocation in the following example (I’m using the Tullio package, but I think it also applies in more general contexts): using Tullio using Loop…

---

## [Can this contraction run faster without memory allocation?](https://discourse.julialang.org/t/can-this-contraction-run-faster-without-memory-allocation/66761)

<div class="topic-metadata">

**Author:** [@Frisus95](https://discourse.julialang.org/u/Frisus95)\
**Replies:** 0\
**Last updated:** [August 21, 2021, 1:51am UTC](https://discourse.julialang.org/t/can-this-contraction-run-faster-without-memory-allocation/66761 "2021-08-21T01:51:42Z")

</div>

Hello everyone! is it possible to make this code run faster and not allocate more memory than necessary? julia\> function funza(Tensor, indices) result = 0.0 for i = 1:5 T1 = Tensor\[indices\[1\],in…

---

## [Why putting partial array in the function argument and update it actually does not change the array?](https://discourse.julialang.org/t/why-putting-partial-array-in-the-function-argument-and-update-it-actually-does-not-change-the-array/66754)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 13\
**Last updated:** [August 20, 2021, 11:33pm UTC](https://discourse.julialang.org/t/why-putting-partial-array-in-the-function-argument-and-update-it-actually-does-not-change-the-array/66754 "2021-08-20T23:33:12Z")

</div>

A small question. I put the 1st column of an array in the function argument, and update its first value to 100.0. However the array does not really change, why? Z = \[1.0 2.0; 3.0 4.0\] function f(theta::Array{Float64,1…

---

## [Why the global variable is not updated even already initialized and included in all modules?](https://discourse.julialang.org/t/why-the-global-variable-is-not-updated-even-already-initialized-and-included-in-all-modules/66704)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 12\
**Last updated:** [August 20, 2021, 7:44pm UTC](https://discourse.julialang.org/t/why-the-global-variable-is-not-updated-even-already-initialized-and-included-in-all-modules/66704 "2021-08-20T19:44:51Z")

</div>

Sorry for another stupid question again. First of all, I am not proud of using global variables. My question is very simple. Three modules, A, B, and C, they are in A.jl, B.jl, C.jl. I have defined an array called mus…

---

## [MLJ fit and predict](https://discourse.julialang.org/t/mlj-fit-and-predict/66720)

<div class="topic-metadata">

**Author:** [@Vishal\_Sharma1](https://discourse.julialang.org/u/Vishal_Sharma1)\
**Replies:** 1\
**Last updated:** [August 20, 2021, 6:51pm UTC](https://discourse.julialang.org/t/mlj-fit-and-predict/66720 "2021-08-20T18:51:03Z")

</div>

Through MLJ’s fit and predict methods, we get the machine trained and then use it for test sample prediction respectively. What is the best way to get the training sample prediction? If I use predict on the training sa…

---

## [How do findall ,findmax ,findmin, argmax, argmin work on SparseArrays/SparseMatrixCSC](https://discourse.julialang.org/t/how-do-findall-findmax-findmin-argmax-argmin-work-on-sparsearrays-sparsematrixcsc/66735)

<div class="topic-metadata">

**Author:** [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)\
**Replies:** 3\
**Last updated:** [August 20, 2021, 5:37pm UTC](https://discourse.julialang.org/t/how-do-findall-findmax-findmin-argmax-argmin-work-on-sparsearrays-sparsematrixcsc/66735 "2021-08-20T17:37:49Z")

</div>

Do findall findmax ,findmin, argmax, argmin work on SparseArrays by convert sparse to Matrix type before doing operations on these functions? If yes, is the computational cost too much of converting?

---

## [Understanding Stackoverflow errors and recursion in Julia](https://discourse.julialang.org/t/understanding-stackoverflow-errors-and-recursion-in-julia/66647)

<div class="topic-metadata">

**Author:** [@dannofthursday](https://discourse.julialang.org/u/dannofthursday)\
**Replies:** 1\
**Last updated:** [August 20, 2021, 1:51pm UTC](https://discourse.julialang.org/t/understanding-stackoverflow-errors-and-recursion-in-julia/66647 "2021-08-20T13:51:53Z")

</div>

I am going through the very excellent Algorithms course, in Coursera, and am trying to implement all of the problems in Julia, so that I can learn about algorithms and practice with Julia. A couple of weeks back, we were…

---

## [DataFrames: Most efficient way to compute statistics on multiple/nested subgroups](https://discourse.julialang.org/t/dataframes-most-efficient-way-to-compute-statistics-on-multiple-nested-subgroups/66714)

<div class="topic-metadata">

**Author:** [@told](https://discourse.julialang.org/u/told)\
**Replies:** 2\
**Last updated:** [August 20, 2021, 1:33pm UTC](https://discourse.julialang.org/t/dataframes-most-efficient-way-to-compute-statistics-on-multiple-nested-subgroups/66714 "2021-08-20T13:33:29Z")

</div>

I have a dataset with population statistics similar to this: using DataFrames #make a dummy data set df = DataFrame(date = \[1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2\], age\_group = \[1, 2, 2, 3, 4, 4, 5,…

---

## [Cannot install packages - \`no space left on device (ENOSPC)\`](https://discourse.julialang.org/t/cannot-install-packages-no-space-left-on-device-enospc/66665)

<div class="topic-metadata">

**Author:** [@sim](https://discourse.julialang.org/u/sim)\
**Replies:** 6\
**Last updated:** [August 20, 2021, 9:38am UTC](https://discourse.julialang.org/t/cannot-install-packages-no-space-left-on-device-enospc/66665 "2021-08-20T09:38:36Z")

</div>

Hello, I recently installed Julia 1.6.2 on my remote machine, added julia to PATH, it works. Then I wanted to add some packages (like Plots, Makie, Flux, Franklin), and everytime I do add PackageName I get the followi…

---

## [How to avoid \`using MyPackage\` in every doctest?](https://discourse.julialang.org/t/how-to-avoid-using-mypackage-in-every-doctest/66675)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 12\
**Last updated:** [August 20, 2021, 9:35am UTC](https://discourse.julialang.org/t/how-to-avoid-using-mypackage-in-every-doctest/66675 "2021-08-20T09:35:39Z")

</div>

I have a jldoctest entry which is: julia\> using CellListMap julia\> box = Box(\[100,70,130\],12) Box{OrthorhombicCell, 3, Float64, 9} unit cell matrix: \[100.0 0.0 0.0; 0.0 70.0 0.0; 0.0 0.0 130.0\] cutoff: 12.0 numbe…

---

## [Use Plots() library to graph a colored surface](https://discourse.julialang.org/t/use-plots-library-to-graph-a-colored-surface/66561)

<div class="topic-metadata">

**Author:** [@Norbert-droid](https://discourse.julialang.org/u/Norbert-droid)\
**Replies:** 8\
**Last updated:** [August 19, 2021, 1:31pm UTC](https://discourse.julialang.org/t/use-plots-library-to-graph-a-colored-surface/66561 "2021-08-19T13:31:07Z")

</div>

I want to make a surface in 3D and color the surface using a fourth coordinate. I want to do this task using Plots and Plotly to rotate the graph at all angles. Here I put examples of the surfaces I want:

---

## [How to define many variables in few lines?](https://discourse.julialang.org/t/how-to-define-many-variables-in-few-lines/65788)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 41\
**Last updated:** [August 20, 2021, 7:27am UTC](https://discourse.julialang.org/t/how-to-define-many-variables-in-few-lines/65788 "2021-08-20T07:27:27Z")

</div>

I am very grateful that learned from many guys here that, there is a trick to ‘lock’ the type of a variable by doing a const + Ref trick. Now, if I have many variables, say 100 variables, how to define them in as few li…

---

## [Feedback for small spectroscopic unit conversion package](https://discourse.julialang.org/t/feedback-for-small-spectroscopic-unit-conversion-package/43419)

<div class="topic-metadata">

**Author:** [@Olivier\_Merchiers](https://discourse.julialang.org/u/Olivier_Merchiers)\
**Replies:** 0\
**Last updated:** [July 21, 2020, 8:19am UTC](https://discourse.julialang.org/t/feedback-for-small-spectroscopic-unit-conversion-package/43419 "2020-07-21T08:19:40Z")

</div>

Hello everyone, I’ve made a small package SpectroscopicUnits.jl to help me converting between units commonly used in spectroscopy. It is basically a wrapper around the uconvert function of Unitful.jl and exports a sing…

---

## [\[ANN\] UnitfulRecipes.jl 1.0](https://discourse.julialang.org/t/ann-unitfulrecipes-jl-1-0/45365)

<div class="topic-metadata">

**Author:** [@jw3126](https://discourse.julialang.org/u/jw3126)\
**Replies:** 0\
**Last updated:** [August 22, 2020, 1:35pm UTC](https://discourse.julialang.org/t/ann-unitfulrecipes-jl-1-0/45365 "2020-08-22T13:35:01Z")

</div>

\[ANN\] UnitfulRecipes.jl 1.0 @briochemc and myself are happy to announce UnitfulRecipes.jl 1.0. UnitfulRecipes.jl provides recipes for plotting figures (Plots.jl) when using data with units (Unitful.jl). using Unitful, …

---

## [Set breakpoint when running from command line](https://discourse.julialang.org/t/set-breakpoint-when-running-from-command-line/66701)

<div class="topic-metadata">

**Author:** [@astrobc1](https://discourse.julialang.org/u/astrobc1)\
**Replies:** 0\
**Last updated:** [August 20, 2021, 3:26am UTC](https://discourse.julialang.org/t/set-breakpoint-when-running-from-command-line/66701 "2021-08-20T03:26:34Z")

</div>

I’d like to set a breakpoint (@bp) when running code from the command line: julia filename.jl where the breakpoint could be inside a function or within the global scope of the file. Is this currently possible via Debugge…

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

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