# General Usage

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

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

**Page:** 574

---

## [Recipe to plot simple dataframes](https://discourse.julialang.org/t/recipe-to-plot-simple-dataframes/64889)

<div class="topic-metadata">

**Author:** [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Replies:** 7\
**Last updated:** [July 19, 2021, 7:57am UTC](https://discourse.julialang.org/t/recipe-to-plot-simple-dataframes/64889 "2021-07-19T07:57:22Z")

</div>

Looking for a default recipe for plotting simple dataframes with plot(df). Two questions: Does such recipe currently exist? Is something like the code snippet below a valid Plots’ recipe? using DataFrames, Plots; gr(…

---

## [No plot with CairoMakie](https://discourse.julialang.org/t/no-plot-with-cairomakie/64914)

<div class="topic-metadata">

**Author:** [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Replies:** 3\
**Last updated:** [July 19, 2021, 7:42am UTC](https://discourse.julialang.org/t/no-plot-with-cairomakie/64914 "2021-07-19T07:42:27Z")

</div>

I have tried the tutorial and I do not see any plot under Windows 10 julia\> using CairoMakie julia\> x = range(0, 10, length=100); julia\> y = sin.(x); julia\> lines(x, y) Scene (800px, 600px): 18 Plots: ├ Poly{Tuple…

---

## [Handling a "Mixed Type" Matrix (String, Float64 and Int64)](https://discourse.julialang.org/t/handling-a-mixed-type-matrix-string-float64-and-int64/64910)

<div class="topic-metadata">

**Author:** [@Peter-Jolly](https://discourse.julialang.org/u/Peter-Jolly)\
**Replies:** 2\
**Last updated:** [July 19, 2021, 7:18am UTC](https://discourse.julialang.org/t/handling-a-mixed-type-matrix-string-float64-and-int64/64910 "2021-07-19T07:18:20Z")

</div>

I am trying to copy a string vector into a numerical matrix (2D) column and having some difficulty. I realise Julia one needs to take note on how to define the matrix type. Please see my simple test example below. The co…

---

## [Using CuArrays with Iterators.product()](https://discourse.julialang.org/t/using-cuarrays-with-iterators-product/64824)

<div class="topic-metadata">

**Author:** [@gregory](https://discourse.julialang.org/u/gregory)\
**Replies:** 1\
**Last updated:** [July 19, 2021, 6:24am UTC](https://discourse.julialang.org/t/using-cuarrays-with-iterators-product/64824 "2021-07-19T06:24:34Z")

</div>

Hello, I am trying to port some CPU code to GPUs where I run over a high-dimensional array and perform some operations. Below is a MWE of what I am doing on the CPU: function sequential\_rand!(x, test) for i in Ite…

---

## [Reading data text files delimited with both spaces & tabs](https://discourse.julialang.org/t/reading-data-text-files-delimited-with-both-spaces-tabs/64851)

<div class="topic-metadata">

**Author:** [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Replies:** 13\
**Last updated:** [July 19, 2021, 4:54am UTC](https://discourse.julialang.org/t/reading-data-text-files-delimited-with-both-spaces-tabs/64851 "2021-07-19T04:54:14Z")

</div>

Is it possible in CSV.jl, DelimitedFiles.jl, or other, to read text files that contain both spaces & tabs, in the header and/or data sections? An example is provided below. NB: the hidden spaces and tabs should be ther…

---

## [Just curious about a code in Base](https://discourse.julialang.org/t/just-curious-about-a-code-in-base/64893)

<div class="topic-metadata">

**Author:** [@josePereiro](https://discourse.julialang.org/u/josePereiro)\
**Replies:** 7\
**Last updated:** [July 19, 2021, 3:16am UTC](https://discourse.julialang.org/t/just-curious-about-a-code-in-base/64893 "2021-07-19T03:16:04Z")

</div>

Hi, I was hanging around Base and I found this method. @edit Base.hash\_32\_32(UInt32(1)) # juila 1.6.1 function hash\_32\_32(n::UInt32) a::UInt32 = n # what is it the purpose of this line? a = a + 0x7ed55d16 + a \<\<…

---

## [Attempting to customise broadcasting for BioSequences](https://discourse.julialang.org/t/attempting-to-customise-broadcasting-for-biosequences/64892)

<div class="topic-metadata">

**Author:** [@Ward9250](https://discourse.julialang.org/u/Ward9250)\
**Replies:** 0\
**Last updated:** [July 19, 2021, 1:16am UTC](https://discourse.julialang.org/t/attempting-to-customise-broadcasting-for-biosequences/64892 "2021-07-19T01:16:12Z")

</div>

Hello! I’m currently trying to customise and improve how Broadcasting is done with BioSequences.jl - types. Specifically LongSequence at this moment, for a v3 release. And I could do with some help and advice doing it pr…

---

## [Squeeze out the last 10% of performance for a sorting function?](https://discourse.julialang.org/t/squeeze-out-the-last-10-of-performance-for-a-sorting-function/64539)

<div class="topic-metadata">

**Author:** [@Seif\_Shebl](https://discourse.julialang.org/u/Seif_Shebl)\
**Replies:** 26\
**Last updated:** [July 18, 2021, 11:55pm UTC](https://discourse.julialang.org/t/squeeze-out-the-last-10-of-performance-for-a-sorting-function/64539 "2021-07-18T23:55:42Z")

</div>

I wrote a straightforward implementation of the insertion sort algorithm in Julia below. Then I wrote the exact translation in C to compare with Julia. I noticed a performance gap of about 10% in favor of C implementatio…

---

## [Modify function with macros](https://discourse.julialang.org/t/modify-function-with-macros/64885)

<div class="topic-metadata">

**Author:** [@alequa](https://discourse.julialang.org/u/alequa)\
**Replies:** 2\
**Last updated:** [July 18, 2021, 10:57pm UTC](https://discourse.julialang.org/t/modify-function-with-macros/64885 "2021-07-18T22:57:10Z")

</div>

Hi I would like to do modify a function inner scope with a macro. My goal is to add blocks of specific code within a simulation loop. These blocks have to: instantiate variables interact with internal variables updat…

---

## [How does Profile work on non-yielding functions?](https://discourse.julialang.org/t/how-does-profile-work-on-non-yielding-functions/64883)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 0\
**Last updated:** [July 18, 2021, 9:42pm UTC](https://discourse.julialang.org/t/how-does-profile-work-on-non-yielding-functions/64883 "2021-07-18T21:42:41Z")

</div>

The Profile module is a statistical profiler, so it checks frequently what the program is doing. I can imagine that works fine if the code has yield points in it (e.g. allocations or I/O or yield()), but how does control…

---

## [RPC API in Julia?](https://discourse.julialang.org/t/rpc-api-in-julia/52352)

<div class="topic-metadata">

**Author:** [@sairus7](https://discourse.julialang.org/u/sairus7)\
**Replies:** 4\
**Last updated:** [July 18, 2021, 8:33pm UTC](https://discourse.julialang.org/t/rpc-api-in-julia/52352 "2021-07-18T20:33:40Z")

</div>

How can I write a simple RPC server in Julia? As far as I can see, I need the following parts: I/O transport (pipes / sockets / websockets / ZMQ / etc.) Serialization protocol (JSON / BSON / MsgPack / Protobuf), and R…

---

## [Why loading a Package is slow (Julia 1.6)](https://discourse.julialang.org/t/why-loading-a-package-is-slow-julia-1-6/64868)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 1\
**Last updated:** [July 18, 2021, 7:00pm UTC](https://discourse.julialang.org/t/why-loading-a-package-is-slow-julia-1-6/64868 "2021-07-18T19:00:53Z")

</div>

I know that there has been a lot of conversation in the past about this, but most of the questions end with a response like “in Julia 1.6 the loading time will be much better”. Since we are in Julia 1.6 I would like to …

---

## [What is a similar function of \`Grid\` in Mathematica for plotting?](https://discourse.julialang.org/t/what-is-a-similar-function-of-grid-in-mathematica-for-plotting/64860)

<div class="topic-metadata">

**Author:** [@powerzf](https://discourse.julialang.org/u/powerzf)\
**Replies:** 4\
**Last updated:** [July 18, 2021, 2:49pm UTC](https://discourse.julialang.org/t/what-is-a-similar-function-of-grid-in-mathematica-for-plotting/64860 "2021-07-18T14:49:14Z")

</div>

What is the Julia function corresponding to the Grid function in Mathematica

---

## [Where is \`OrdinaryDiffEq.ode\_interpolation\`'s output type defined?](https://discourse.julialang.org/t/where-is-ordinarydiffeq-ode-interpolation-s-output-type-defined/64844)

<div class="topic-metadata">

**Author:** [@cadojo](https://discourse.julialang.org/u/cadojo)\
**Replies:** 1\
**Last updated:** [July 18, 2021, 9:56am UTC](https://discourse.julialang.org/t/where-is-ordinarydiffeq-ode-interpolation-s-output-type-defined/64844 "2021-07-18T09:56:14Z")

</div>

I’ve defined my own subtype of DenseArray called CartesianState. The source code is available here. The following functionality works… state = CartesianState(randn(6)) similar(state) SymbolicUtils.Code.create\_array(::Ty…

---

## [Indexing 2D CuArray](https://discourse.julialang.org/t/indexing-2d-cuarray/64825)

<div class="topic-metadata">

**Author:** [@vavrines](https://discourse.julialang.org/u/vavrines)\
**Replies:** 3\
**Last updated:** [July 18, 2021, 8:27am UTC](https://discourse.julialang.org/t/indexing-2d-cuarray/64825 "2021-07-18T08:27:38Z")

</div>

I’m learning to use CUDA.jl based on the tutorial, and trying to write a kernel for 2D array. using CUDA function divide0!(y, a, b) for j = 1:size(y, 2) for i = 1:size(y, 1) @inbounds y\[i, j\] = …

---

## [Calling julia code from matlab](https://discourse.julialang.org/t/calling-julia-code-from-matlab/58598)

<div class="topic-metadata">

**Author:** [@Noodle](https://discourse.julialang.org/u/Noodle)\
**Replies:** 3\
**Last updated:** [July 18, 2021, 6:42am UTC](https://discourse.julialang.org/t/calling-julia-code-from-matlab/58598 "2021-07-18T06:42:36Z")

</div>

Hello everyone I am trying to call Julia codes from MATLAB, as I need to send my Julia code to a MATLAB user. It seems for Julia \>1.0 the solution is GitHub - byuflowlab/Mex.jl: Embedding Julia in the MATLAB process. I…

---

## [Using Loop](https://discourse.julialang.org/t/using-loop/64736)

<div class="topic-metadata">

**Author:** [@sajad\_ghassemi](https://discourse.julialang.org/u/sajad_ghassemi)\
**Replies:** 16\
**Last updated:** [July 18, 2021, 6:31am UTC](https://discourse.julialang.org/t/using-loop/64736 "2021-07-18T06:31:07Z")

</div>

Hi dear friends, I wrote a code to model a full bridge rectifier in electrical engineering in MATLAB and it works and the plot of voltage is true. now I am going to write that in Julia. I don’t know why the for loop does…

---

## [StaticArrays compilation performance bug](https://discourse.julialang.org/t/staticarrays-compilation-performance-bug/64811)

<div class="topic-metadata">

**Author:** [@nabla](https://discourse.julialang.org/u/nabla)\
**Replies:** 4\
**Last updated:** [July 18, 2021, 4:26am UTC](https://discourse.julialang.org/t/staticarrays-compilation-performance-bug/64811 "2021-07-18T04:26:01Z")

</div>

I also posted this as a StaticArrays issue: with Julia 1.7 and StaticArrays v0.12.5: julia\> N = 14; m = SMatrix{N,N}(rand(N,N)); julia\> x-\>x\*m # works fine #1 (generic function with 1 method) julia\> @time \[x-\>x\*g for …

---

## [Cannot install CUDA.jl on Linux](https://discourse.julialang.org/t/cannot-install-cuda-jl-on-linux/64625)

<div class="topic-metadata">

**Author:** [@ChunXi\_Zhang](https://discourse.julialang.org/u/ChunXi_Zhang)\
**Replies:** 3\
**Last updated:** [July 17, 2021, 9:58pm UTC](https://discourse.julialang.org/t/cannot-install-cuda-jl-on-linux/64625 "2021-07-17T21:58:27Z")

</div>

I’ve been using CUDA.jl on windows so far, today I switched to Manjaro, and installed the julia 1.6.1, and tried to install CUDA.jl. But there is an error for not founding the lib: julia\> using CUDA \[ Info: Precompilin…

---

## [How to reduce large memory allocation by lu! with sparse matrices](https://discourse.julialang.org/t/how-to-reduce-large-memory-allocation-by-lu-with-sparse-matrices/64791)

<div class="topic-metadata">

**Author:** [@YukiyaSaito](https://discourse.julialang.org/u/YukiyaSaito)\
**Replies:** 8\
**Last updated:** [July 17, 2021, 9:12pm UTC](https://discourse.julialang.org/t/how-to-reduce-large-memory-allocation-by-lu-with-sparse-matrices/64791 "2021-07-17T21:12:54Z")

</div>

In my code, I have to solve a large sparse linear system (14000 x 14000) many times to integrate a stiff system of ODE. Since the memory allocation by the backslash operator \\ is quite large, I thought of manually perfo…

---

## [Tips for moving from Julia to Numpy/Python?](https://discourse.julialang.org/t/tips-for-moving-from-julia-to-numpy-python/64702)

<div class="topic-metadata">

**Author:** [@Orbots](https://discourse.julialang.org/u/Orbots)\
**Replies:** 33\
**Last updated:** [July 17, 2021, 3:56pm UTC](https://discourse.julialang.org/t/tips-for-moving-from-julia-to-numpy-python/64702 "2021-07-17T15:56:03Z")

</div>

I think I have to switch from using Julia to Python/Numpy. I know. I’m going the wrong way! Still, it’s become increasing apparent it’s the right thing to do. I know Julia much better than Python/Numpy, but Julia isn…

---

## [ModelingToolkit: Different ways to access array of variables](https://discourse.julialang.org/t/modelingtoolkit-different-ways-to-access-array-of-variables/59939)

<div class="topic-metadata">

**Author:** [@jairorua](https://discourse.julialang.org/u/jairorua)\
**Replies:** 3\
**Last updated:** [July 17, 2021, 10:57am UTC](https://discourse.julialang.org/t/modelingtoolkit-different-ways-to-access-array-of-variables/59939 "2021-07-17T10:57:46Z")

</div>

Hello, Let’s consider a general function that aims at being a reusable pin/connector of arrays of variables. using ModelingToolkit function arrayConnection(;name, discretizations = 4) @parameters t @variables x\[1:d…

---

## [What is the difference between x .= and x\[:\] =](https://discourse.julialang.org/t/what-is-the-difference-between-x-and-x/64790)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 2\
**Last updated:** [July 17, 2021, 8:03am UTC](https://discourse.julialang.org/t/what-is-the-difference-between-x-and-x/64790 "2021-07-17T08:03:19Z")

</div>

julia\> x = \[1,2,3\] 3-element Vector{Int64}: 1 2 3 In this case they are the same. Are they always the same? What is the difference? julia\> x .= \[10, 20, 30\] 3-element Vector{Int64}: 10 20 30 julia\> x\[:\] = \[11, 2…

---

## [Trouble creating a type to be a vector of another defined type](https://discourse.julialang.org/t/trouble-creating-a-type-to-be-a-vector-of-another-defined-type/64786)

<div class="topic-metadata">

**Author:** [@mistamista](https://discourse.julialang.org/u/mistamista)\
**Replies:** 3\
**Last updated:** [July 17, 2021, 4:25am UTC](https://discourse.julialang.org/t/trouble-creating-a-type-to-be-a-vector-of-another-defined-type/64786 "2021-07-17T04:25:15Z")

</div>

So what I want to do is something like: Define a type Point that is constructed from floats passed by the user. This is supposed to store the coordinates of a point. struct Point x::Float64 y::Float64 end This works…

---

## [Counterintuitive array update allocations](https://discourse.julialang.org/t/counterintuitive-array-update-allocations/63490)

<div class="topic-metadata">

**Author:** [@ismedina](https://discourse.julialang.org/u/ismedina)\
**Replies:** 11\
**Last updated:** [July 17, 2021, 3:59am UTC](https://discourse.julialang.org/t/counterintuitive-array-update-allocations/63490 "2021-07-17T03:59:32Z")

</div>

I’ve run into a kind-of counterintuitive behavior when coding some example. I have an array A\_field, which I want to update by adding certain values in certain positions. These are provided by a an array of arrays of (fl…

---

## [Symbolics.jl Jacobian](https://discourse.julialang.org/t/symbolics-jl-jacobian/64654)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 6\
**Last updated:** [July 17, 2021, 3:53am UTC](https://discourse.julialang.org/t/symbolics-jl-jacobian/64654 "2021-07-17T03:53:30Z")

</div>

I have searched far and wide and have no luck setting up a script to do a Jacobian calculation using Symbolics.jacobian. Can someone shoot me example syntax for a vector of symbolics. I get errors that look like this: …

---

## [GeometryBasics Rect](https://discourse.julialang.org/t/geometrybasics-rect/64779)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 2\
**Last updated:** [July 17, 2021, 2:42am UTC](https://discourse.julialang.org/t/geometrybasics-rect/64779 "2021-07-17T02:42:40Z")

</div>

Rect says Construct a HyperRectangle enclosing all points. which it does, but I think there is a better rectangle for this job than the one returned. julia\> Rect(Circle(Point((0.,0.)), 1.)) Rect2D{Float64}(\[-1.0, -1…

---

## [From Zero to Jupyter-lab on Linux for Julians?](https://discourse.julialang.org/t/from-zero-to-jupyter-lab-on-linux-for-julians/64762)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 8\
**Last updated:** [July 16, 2021, 10:31pm UTC](https://discourse.julialang.org/t/from-zero-to-jupyter-lab-on-linux-for-julians/64762 "2021-07-16T22:31:58Z")

</div>

I have a new computer since the last time I used Jupyter-lab. I use Jupyter-lab just for Julia, and so have no need for python stuff other than as infrastructure for things like Jupyter. I installed IJulia.jl and Conda.…

---

## [Problem with lyap(Q,R)](https://discourse.julialang.org/t/problem-with-lyap-q-r/64745)

<div class="topic-metadata">

**Author:** [@ylish](https://discourse.julialang.org/u/ylish)\
**Replies:** 11\
**Last updated:** [July 16, 2021, 8:34pm UTC](https://discourse.julialang.org/t/problem-with-lyap-q-r/64745 "2021-07-16T20:34:48Z")

</div>

Hello everybody, I am new to Julia and I am trying to rewrite and improve some code that I have in MATLAB. I have come across something that I cannot fix. Could someone see what the issue is? I have the following code: …

---

## [Save code generated by macro to file](https://discourse.julialang.org/t/save-code-generated-by-macro-to-file/64760)

<div class="topic-metadata">

**Author:** [@sloede](https://discourse.julialang.org/u/sloede)\
**Replies:** 7\
**Last updated:** [July 16, 2021, 7:26pm UTC](https://discourse.julialang.org/t/save-code-generated-by-macro-to-file/64760 "2021-07-16T19:26:32Z")

</div>

I have a string macro that generates a lot of code, and I would like to store this code in a Julia file such that I can just include it the next time it is required. How can I achieve this? I assume it has to be realized…

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

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